简体   繁体   中英

Azure Web Farm - Unable to find assembly

I have been tasked with deploying our 10 year old asp.net web application into a web farm environment hosted by MS Azure. I created two virtual machines and deployed our solution to both. When I visit the site directly on each server, everything works fine. I created a load balancer in Azure and have the two VMs as the back end pool. The site loads fine but as soon as a user logs in and commits one post back, we begin seeing the following error:

Server Error in '/' Application.

Unable to find assembly 'App_Web_akoswspw, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.Serialization.SerializationException: Unable to find assembly 'App_Web_akoswspw, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

I'm starting to believe its because of assembly mismatch as I am able to get the site to run for a bit if I copy the contents of C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Temporary ASP.NET Files from one machine to the other. We are stumped as this same application runs for another client in a web farm environment. Any thoughts or ideas on how to fix this issue?

The reason you get this error message is that some object are persisted to ViewState and these object type came from a dynamically compiled assembly. These type can be lot of things like Pages, anonymous type, etc. When the page do a postback, it may execute on the other server and this type is not known by this server.

In order to avoid this error, only persist object coming from real assembly or use load balancer that always use the same server for a specific user (sticky session).

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