简体   繁体   中英

Conflicting System.Web.Http.Cors assembly in azure mobile services

Suddenly I got the following error when publishing to Azure Mobile Services.

"Error Found conflicts between different versions of the same dependent assembly 'System.Web.Http.Cors': 5.1.0.0, 5.2.2.0. Please change your project to use only one version. App.Hosting 2014-09-20 23:40:26"

I use Microsoft.AspNet.WebApi.Cors and WindowsAzure.MobileServices.Backend (1.0.348).

I have tried going through all references and I cant find any pointing at 5.2.2.0. I have also tried upgrading to 5.2.2.0 however when doing so I get: "Error Boot strapping failed: executing 'WebApiConfig.Register' caused an exception: 'Could not load file or assembly 'System.Web.Http.Cors, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. App.Hosting 2014-09-20 23:06:20"

I can not understand why I get this error and it seem to have start to occur with no apparent reason.

Any pointer is appreciated.

We are in the process of updating to the newly released ASP.NET Web API 5.2 and it looks like we missed an assembly redirect for the CORS assembly.

In a couple of days you will be able to use the full ASP.NET Web API 5.2 but the upgrade has to complete first. To fix your problem now, you should be able to just remove your own CORS assembly (assuming you are only setting the origins) and then set them using the MS_CrossDomainOrigins app setting in your local web.config as described in this blog [1], for example:

<add key="MS_CrossDomainOrigins" value="http://testhost, http://sample" />

Sorry for the inconvenience!

Henrik

[1] http://azure.microsoft.com/blog/2014/07/28/azure-mobile-services-net-updates/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM