Error on WebAPI after deployment to Azure App Services

Encountered this below error today while deploying a WebApI to Azure App Services. Initially it wasn’t very clear what the error was about so we checked the bin folder for the below assembly but couldn’t find it. Since the API was working locally the answer had to be a configuration change from Dev to Prod (i.e a Webconfig issue) or there were some artifacts left over from the creation of the Application Service in Azure that had nothing to do without project. So we first redeployed the WebConfig file to see if this will take care of the issue but it didn’t and finally we simply deleted any extra files that were present in the directory while publishing from within VS.

Attempt by security transparent method ‘System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()’ to access security critical method ‘System.Web.WebPages.ApplicationPart..ctor(System.Reflection.Assembly, System.String)’ failed.]

The screen you are interested in is

And you need to check the box that says “Remove Additional Files at Destination” and then redeploy the code again.

https://stackoverflow.com/questions/29755925/attempt-by-security-transparent-method-system-web-webpages-administration-sitea

Please Consider Subscribing