You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

部署含Pomelo.EntityFrameworkCore.MySql.dll的Web服务异常排查与解决

问题描述

我有两个技术架构一致的项目,一个仅支持Oracle数据库,另一个可通过appsettings.json配置切换Oracle与MySQL。两个项目在Visual Studio中运行正常,API及数据库增删改操作均无异常。但发布后者并部署为Web服务时,出现“操作无法完成,发生异常”错误;若移除Pomelo.dll则部署成功,但调用任何API都会返回500内部服务器错误,先部署再复制Pomelo.dll也无法解决问题。

项目.csproj文件内容
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <OutputType>WinExe</OutputType>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>

  <ItemGroup>
    <Content Remove="compilerconfig.json" />
  </ItemGroup>

  <ItemGroup>
    <COMReference Include="OracleInProcServer">
      <WrapperTool>tlbimp</WrapperTool>
      <VersionMinor>0</VersionMinor>
      <VersionMajor>5</VersionMajor>
      <Guid>f2d4ed20-ffd3-101a-adf2-04021c007002</Guid>
      <Lcid>0</Lcid>
      <Isolated>false</Isolated>
      <EmbedInteropTypes>true</EmbedInteropTypes>
    </COMReference>
  </ItemGroup>

  <ItemGroup>
    <None Include="compilerconfig.json" />
    <None Include="wwwroot\Kiosk.ini" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\Infra\Data\DataContext.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Content Update="appsettings.Development.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </Content>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="M2Mqtt" Version="4.3.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.10">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="MySql.EntityFrameworkCore" Version="8.0.5" />
    <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
    <PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.110" />
    <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="Ultimate_AG">
      <HintPath>..\..\..\..\..\..\..\..\..\OMEGASYS\Oprg\Ultimate_AG.dll</HintPath>
    </Reference>
    <Reference Include="Ultimate_HOC">
      <HintPath>..\..\..\..\..\OMEGASYS\Oprg\Ultimate_HOC.dll</HintPath>
    </Reference>
  </ItemGroup>

</Project>

内容的提问来源于stack exchange,提问作者Anthony Ghosn

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 01:39:54