The type initializer for 'System.Web.Http.GlobalConfiguration' threw an exception

前端 未结 3 534
花落未央
花落未央 2021-01-30 12:54

I have added a new Web API project. I install Cors

PM> Install-Package Microsoft.AspNet.WebApi.Cors -Pre

Then when I run my project, I get t

3条回答
  •  庸人自扰
    2021-01-30 13:11

    I came across the same issue and found a blog post on it. According to this blog post if you use the release candidate it should fix the error

    Install-Package Microsoft.AspNet.WebApi -IncludePrerelease
    

    From here: http://wp.sjkp.dk/webapi-and-cors-enabled-rest-services/

    This worked for me :D

    In other words, it was fixed in 5.1.0-rc1 release.

提交回复
热议问题