c# - NETCore Web 应用启动时无法加载文件或程序集
问题描述
我NetCore 2.2
在使用 VS2017 发布后使用以下设置部署应用程序时,使用 开发的应用程序出现问题: - 发布 - netcoreapp2.2 - Framework-Dependant - win-x64 到 IIS 服务器开始它说:
Application startup exception
System.IO.FileNotFoundException: Could not load file or assembly 'Jump.Shared.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Impossible to find specified file.
File name: 'Jump.Shared.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
现在问题似乎是我的引用结构。我有主要项目,Scan.Web
它正在引用Scan.Core
,Scan.Infrastructure
这里是 .csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
...
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Scan.Core\Scan.Core.csproj" />
<ProjectReference Include="..\Scan.Infrastructure\Scan.Infrastructure.csproj" />
</ItemGroup>
</Project>
然后Scan.Infrastructure
是引用有问题的Jump.Shared.Infrastructure
,这里是csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
...
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\JumpShared\Jump.Shared.Infrastructure\Jump.Shared.Infrastructure.csproj" />
<ProjectReference Include="..\Scan.Core\Scan.Core.csproj" />
</ItemGroup>
</Project>
最后是罪魁祸首的.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.2.0" />
<PackageReference Include="MongoDB.Driver" Version="2.8.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Jump.Shared.Core\Jump.Shared.Core.csproj" />
</ItemGroup>
</Project>
我不知道为什么,当在 VS2017 的调试中一切正常,在 IIS 上发布它时,它无法找到这个参考。构建给了我Jump.Shared.Infrastructure.dll
解决方案
推荐阅读
- html - Flutter Web:在特定页面上添加 HTML 脚本
- matlab - matlab simulink 采样时间不一致
- ios - 当wrappedValue GeometryReader PopUp被激活SwiftUI时,灰色/覆盖/模糊导航栏
- r - 为什么 approx3d 不会插入 3d 数组的最后一个元素?
- python - 使用 esy-osmfilter 获得所有方法
- reverse-engineering - PE(Portable Executable)文件的数字证书是否在文件的覆盖中?
- git - 如何记录我的本地 git push 历史记录?
- azure - 限制对 Web 应用程序的访问
- python - Python中函数的并行执行
- python - 循环遍历列表中的类初始化