There is an Azure Cloud service with webrole project developed in ASP.NET MVC 4 and JQuery.
When the cloud service is deployed with Debug build, everything works fine.
But Release build has UI issues and also some exceptions like:
Error: Message: The ViewData item that has the key 'XyzID' is of type 'System.Int32' but must be of type 'IEnumerable'. Exception Name: System.InvalidOperationException: The ViewData item that has the key 'XyzID' is of type 'System.Int32' but must be of type 'IEnumerable'.
What could be the reasons?
The most common reason for this is conditional compilation sections. Look for sections marked like
#if DEBUG
#if RELEASE
In fact try to run the project locally with different build configuration such as
Debug
,Release
,Cloud
etc and you may be able to reproduce the issue.