我正在向IIS 10部署一个asp核心2.0网站。
I'm deploying a asp core 2.0 website to IIS 10.
我确保我的应用程序正在使用正确的ISS配置program.settings文件。
I've made sure that my app is using the correct configuration for ISS in the program.settings file.
public class Program { public static void Main(string[] args) { BuildWebHost(args).Run(); } public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>() .Build(); }在我的startup.cs文件中:
And in my startup.cs file:
public void ConfigureServices(IServiceCollection services) { services.Configure<IISOptions>(options => { }); services.AddMvc(); }然而,当我从命令行运行dotnet website.dll时,我得到以下内容命令行窗口中显示的错误消息:
Yet when I run dotnet website.dll from the command line I get the below error message shown in the command line window:
应用程序依赖项中指定的程序集清单(website.deps.json)找不到:包:'Microsoft.AspNetCore.Antiforgery',版本:'2.0.1'路径:'lib / netstandard2.0 /Microsoft.AspNetCore.Antiforgery.dll'这个程序集是预期的使用以下目标清单文件发布应用程序时,在本地运行时存储中: aspnetcore-store-2.0.3.xml
An assembly specified in the application dependencies manifest (website.deps.json) was not found: package: 'Microsoft.AspNetCore.Antiforgery', version: '2.0.1' 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.3.xml
根据错误消息,我猜测Microsoft.AspNetCore.Antiforgery在发布时没有捆绑,因为我在调试时没有收到此错误。
Based off the error message, i'm guessing Microsoft.AspNetCore.Antiforgery isn't being bundled when I publish since I do not receive this error when debugging.
如何确保我的应用在发布到实时环境时能够找到Microsoft.AspNetCore.Antiforgery?
How can I ensure that my app can find Microsoft.AspNetCore.Antiforgery when published to a live environment?
编辑:这是一个基本的核心网站。除了上面使用IIS进行部署的更改之外,此时没有对标准项目进行任何更改。
This is a basic core website. No changes have been made to the standard project at this time apart from the above changes for deployment with IIS.
当我从IIS而不是命令行运行项目时得到一条502.5错误消息。
When I run the project from IIS instead of the command line I get a 502.5 error message.
推荐答案我能够通过将服务器上的核心运行时更新为v2来解决此问题.0.3。
I was able to fix this issue by updating the core runtime on the server to v2.0.3.
如果
可以通过在服务器上安装运行时的v2.0.3来解决该问题。您可以从Microsoft网站下载运行时 www.microsoft/net/download / windows
The issue can be resolved by installing v2.0.3 of the runtime on the server. You can download the runtime from the microsoft site here www.microsoft/net/download/windows
更多推荐
找不到Microsoft.AspNetCore.Antiforgery
发布评论