简体   繁体   中英

Could not load file or assembly or one of its dependencies, error message changing

I've deployed a .NET Framework web app to an Azure web app, framework version 4.7.2. It works fine on my development machine, but when I try to load the Azure web app I get different errors every time I refresh the page, eg:

Could not load file or assembly 'System.Web.DynamicData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Access is denied.

Could not load file or assembly 'Microsoft.ApplicationInsights.TraceListener' or one of its dependencies. Access is denied.

Why one earth does the error change when the page is refreshed? Normally it stays the same until it's fixed.

After uggrading to .NET 4.7.2 from 4.7 and updating lots of nuget packages I was getting different error messages with every refresh (including ones about Antlr3, System.Web.DynamicData, and Application Insights packages). They often said access is denied, BadImageFormatException, Assembly wouldn't load, and one mentioned the temporary internet files folder.

Thanks to this suggestion Antlr3.runtime access denied after updating deployed files I deleted as much stuff on the (Azure web app) server as I thought I could get away with, then redeployed. Then I started getting sensible, consistent error messages. I then realised I had to remove old binding redirects from my web.config file (which included redirects for System.Runtime), which I did, and everything worked again (after a brief error message about temporary internet files which went away upon refresh). Hope that's useful to someone.

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