This is one of the common error you may experience while using WEB API. This error normally occurs if you are using older version web API.
So the simple solution to resolve this issue is upgrade your WEB API.
Easiest option to upgrade your WEB API is by using NuGet package manager.
If you haven’t used NuGet Package Manager along with Visual Studio then I would suggest you to read my earlier article “How to use NuGet Package Manager for Visual Studio 2013”
Once you install NuGet Package Manager then open the Nuget console and execute below commands one by one.
Make sure you wait for the first command to get complete before executing the second one.
Once all the above commands are executed successfully then you have the last command which needs to be executed to install the web api odata version.
Attempt by security transparent method 'System.Web.Http.GlobalConfiguration.get_Configuration()' to access security critical type 'System.Web.Http.HttpConfiguration' failed.” would have disappeared.
So the simple solution to resolve this issue is upgrade your WEB API.
Easiest option to upgrade your WEB API is by using NuGet package manager.
If you haven’t used NuGet Package Manager along with Visual Studio then I would suggest you to read my earlier article “How to use NuGet Package Manager for Visual Studio 2013”
Once you install NuGet Package Manager then open the Nuget console and execute below commands one by one.
Uninstall-Package Microsoft.AspNet.Mvc.FixedDisplayModes
Update-Package Microsoft.AspNet.Mvc -Pre
Update-Package Microsoft.AspNet.WebApi -Pre
Update-Package Microsoft.AspNet.WebApi.Tracing
Make sure you wait for the first command to get complete before executing the second one.
Once all the above commands are executed successfully then you have the last command which needs to be executed to install the web api odata version.
install-package 'Microsoft.AspNet.WebApi.OData –preThat’s all, try to run your application now, I am very much sure that the error “
Attempt by security transparent method 'System.Web.Http.GlobalConfiguration.get_Configuration()' to access security critical type 'System.Web.Http.HttpConfiguration' failed.” would have disappeared.
No comments:
Post a Comment