找不到Microsoft.AspNetCore.Antiforgery

编程入门 行业动态 更新时间:2024-10-23 13:34:44
本文介绍了找不到Microsoft.AspNetCore.Antiforgery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在向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.0。
  • 您创建了一个针对SDK v2.0.3的应用程序
  • 您发布了v2.0.3应用程序运行v2.0.0的服务器
  • 可以通过在服务器上安装运行时的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

    本文发布于:2023-11-14 15:24:13,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1587816.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:找不到   Microsoft   Antiforgery   AspNetCore

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!