Internal Server Error
When I deploy a Asp.Net MVC 4 project on a Windows Azure Web Site, i got an error : "Internal Server Error". Here is some information:
URL: http://jobhunting.azurewebsites.net/Test
Code:
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
}
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
public class TestController : ApiController
{
public string Get()
{
return "Hello world!";
}
}
Requst:GET http://jobhunting.azurewebsites.net/Test HTTP/1.1 User-Agent: Fiddler Host: jobhunting.azurewebsites.netResponse:
HTTP/1.1 500 Internal Server Error Cache-Control: no-cache Pragma: no-cache Content-Length: 0 Expires: -1 Server: Microsoft-IIS/7.5 Set-Cookie: ARRAffinity=a6aec26b7781cb8e149d2231a6c9598687a9317297711bb1b977bb5ecc57e13a;Path=/;Domain=jobhunting.azurewebsites.net X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET X-Powered-By: ARR/2.5 X-Powered-By: ASP.NET Date: Wed, 08 Aug 2012 13:23:32 GMT
Request Diagnostics file:
http://jobhunting.azurewebsites.net/fr000015.xml
I would truly appreciate any guidance I can get on this.快乐在于能够长时间的为自己认为值得的事情努力工作,不管它是什么。
Hi,
Can you make sure the MVC assemblies has been set copy to local property with "True" in MVC 4 website application? And i'd like to suggest you set debug to ture to collect more information about the exception. The configuration will be like this:
<compilation debug="true"/>
In addition, Do you enable .NET 4.5 or .NET 4.0 for MVC web application? Would you like to check the target frameworks version with web config file?
Hope this helps.
Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework
Thanks, Arwind.
assemblies:
Web.config :
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
</configSections>
<connectionStrings>
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="true" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
<profile defaultProvider="DefaultProfileProvider">
<providers>
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</profile>
<membership defaultProvider="DefaultMembershipProvider">
<providers>
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<roleManager defaultProvider="DefaultRoleProvider">
<providers>
<add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</roleManager>
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</sessionState>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<remove name="ExtensionlessUrl-Integrated-4.0" />
<add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,DELETE,PUT" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
快乐在于能够长时间的为自己认为值得的事情努力工作,不管它是什么。
Hi,
Cant you got more details about that exception? (include event logs, stack, trace, etc), 500 error maybe a very broad error message. You can set customErrors mode="On" .
i note there's Microsoft.Practices.EnterpriseLibrary assembly in your list, please let me know the version of the Enterprise Library you're using. The lastest version is here:
http://www.microsoft.com/en-ca/download/details.aspx?id=6836
Hope this helps.
Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework
Thanks, Arwind.
快乐在于能够长时间的为自己认为值得的事情努力工作,不管它是什么。
Why dont you enable intelli trace and check whats going on?
Please go through this
Please mark the replies as Answered if they help and Vote if you found them helpful.
Thanks,Veerendra Kumar.
Will Intelli Trace work well on Windows Azure Web Site environment?快乐在于能够长时间的为自己认为值得的事情努力工作,不管它是什么。
Hi,
Yes, As I was mentioned above, 500 error maybe a very broad error message, we can not make sure where the exception was thrown, so i think you need post them first. The configurations and code looks no propblem.
BR,
Arwind
Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework
Please mark the replies as Answered if they help and Vote if you found them helpful.
快乐在于能够长时间的为自己认为值得的事情努力工作,不管它是什么。
|