Microsoft.AspNetCore.Antiforgery was not found

后端 未结 7 2057
终归单人心
终归单人心 2020-12-20 12:48

I\'m deploying a asp.net core 2.0 website to IIS 10.

I\'ve made sure that my app is using the correct configuration for ISS in the program.settings file.

<         


        
7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-20 13:15

    I had this issue - simple workaround, actually install the NuGet package (I wasn't using it).

    Microsoft.AspNetCore.Antiforgery

    Published, deployed - fixed the issue.

    In another case, when I published the project, a lot of the dlls weren't being placed in the publish folder - including Antiforgery. The below appears to force publishing to add all the required dlls.

    Edit your projectname.json file to ensure PropertyGroup contains PublishWithAspNetCoreTargetManifest = false:

    
        netcoreapp2.0
        false
    
    

    Interested to know why the above works?!

提交回复
热议问题