Asp .Net Core在windows server IIS中运行
Core 虽然2.0版本了,但是还是有大大小小的坑,不过总的来说蛮好的,几天分享一下在IIS中遇到的问题
C:\Users\Administrator>dotnet C:\www\fabu\SuDa.dll
The specified framework 'Microsoft.NETCore.App', version '2.0.0' was not found.
- Check application dependencies and target a framework version installed at:
C:\Program Files\dotnet\shared\Microsoft.NETCore.App
- The following versions are installed:
1.0.4
1.1.1
- Alternatively, install the framework version '2.0.0'.
C:\Users\Administrator>dotnet C:\www\fabu\SuDa.dll
Error:
An assembly specified in the application dependencies manifest (SuDa.deps.json) was not found:
package: 'Microsoft.ApplicationInsights.AspNetCore', version: '2.1.1'
path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll'
This assembly was expected to be in the local runtime store as the application was published using the following target manifest files:
aspnetcore-store-2.0.0-linux-x64.xml;aspnetcore-store-2.0.0-osx-x64.xml;aspnetcore-store-2.0.0-win7-x64.xml;aspnetcore-store-2.0.0-win7-x86.xml
C:\Users\Administrator>dotnet C:\www\fabu\SuDa.dll
Error:
An assembly specified in the application dependencies manifest (SuDa.deps.json) was not found:
package: 'Microsoft.AspNetCore.Antiforgery', version: '2.0.3'
path: 'lib/netstandard2.0/Microsoft.AspNetCore.Antiforgery.dll'
This assembly was expected to be in the local runtime store as the application was published using the following target manifest files:
aspnetcore-store-2.0.8.xml
以上代码是在配置反向代理服务的时候遇到的问题,我项目版本是Core 2.0.9,而我刚开始安装的是1.0.X的kestrel server,被提示找不到指定的框架,然后又卸载了重新来个最新版2.1.1的框架,又被提示找不到项目,而这个项目在指定的环境中运行,最后我又下载了一个2.0.0的,却还是有问题,然后我回去看了一下,我项目版本,最后下载了同样版本的
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\Administrator\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
Hosting environment: Production
Content root path: C:\Users\Administrator
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
项目成功运行
期间找了一些资料,没有一个资料有提示需要跟项目版本相同才能运行,让我晕的是,高版本也不支持低版本。。。

浙公网安备 33010602011771号