In some cases while you have uploaded the compiled and published release files of your ASPNETMVC web application or ASPNET Web Application in Godaddy or any other hosting provider, you might have encountered an error which states “System.Security.SecurityException: Request for the permission of type ‘System.Security.Permissions.ReflectionPermission, mscorlib, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.” might be because partial or medium trust is not supported for Microsoft.Owin.Host.SystemWeb package since this package helps in running OWIN middlewares on IIS integrated pipeline and the assembly does reflection to detect and load OWIN Startup class.
This kind of issue will occur when you build an MVC5 application with OWIN Startup class included having OWIN package installed. Below is the typical way the application error shown when you make <customErrors mode = “Off” /> in Web.Config file.
In order to resolve this issue you need to provide <trust level = “Full”/> under System.Web section in Web.Config file
<system.web> <authentication mode="None" /> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" /> <customErrors mode="Off"/> <trust level="Full" /> </system.web>
Hope this helps to my fellow developers if you are facing the same scenario somewhere