I do have an MVC website, which is running locally just fine. When I'm debugging the application, off course, it's running under the HTTP protocol then everything works fine.
I do have a controller:
[Route("messages/new/form/invoice"), HttpPost]
public ActionResult Invoice(object model)
{
var result = JsonConvert.DeserializeObject<dynamic>(model.ToString());
// Further processing goes here...
}
Note: I've removed the code from this method here because it's irrelivant.
This method is called through AngularJS $http post service. This is done in the following way:
this.saveInvoice = function () {
// Post the form.
$http({
method: "POST",
url: "/messages/new/form/invoice",
data: { model: JSON.stringify(this.invoice) },
headers: { 'Content-Type': 'application/json' }
}).success(function (data) {
$('#content').html(data);
}).error(function (error) {
console.log('An error occured while saving the form: ' + error);
});
}
This function is called through my view:
<form id="invoiceForm" name="invoiceForm" ng-submit="invoiceForm.$valid && invoiceCtrl.saveInvoice();" novalidate ng-init="invoiceCtrl.Init(@Model.FlowId)">
But, as said previously, when running on my local computer, the code is working fine.
But now, I'm deploying it to a server where the website is running under the HTTPS protocol, which is off course different than HTTP on my local machine.
When I'm executing the code and I click the button to submit the form on the webserver, a new window open and that's the "Visual Studio Just In Time Debugger" asking me for an instance of Visual Studio to debug it, but Visual Studio is not installed on that server, which means I need to not select a debugger.
This window is showed to me 3 times. After cancelling all these debugger questions, in my webbrowser I do see the following in the console:
An error occured while saving the form: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Service Unavailable</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"> </HEAD>
<BODY><h2>Service Unavailable</h2>
<hr><p>HTTP Error 503. The service is unavailable.</p>
</BODY></HTML>
This does mean that the application pool has crashed.
So what I've tried right now is the following:
When I'm remote debugging the application, (meaning that I'm attaching to the remote IIS process) I'm setting my breakpoint on the very first line of the method in the post action (see my controller above).
But, this method isn't hit at all, instead the remote debugging does throw a StackOverflowException
as soon as I've hit the button to submit the form.
I'm hoping someone could point me in the right direction because I'm lost and it's driving me nuts for serveral hours.
Edit: Added web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging" />
<sectionGroup name="elmah">
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
<section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
<section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
</sectionGroup>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
<connectionStrings>
<!-- Removed for security reasons. -->
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="owin:AutomaticAppStartup" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="elmah.mvc.disableHandler" value="false" />
<add key="elmah.mvc.disableHandleErrorFilter" value="true" />
<add key="elmah.mvc.requiresAuthentication" value="false" />
<add key="elmah.mvc.IgnoreDefaultRoute" value="false" />
<add key="elmah.mvc.allowedRoles" value="*" />
<add key="elmah.mvc.allowedUsers" value="*" />
<add key="elmah.mvc.route" value="elmah" />
</appSettings>
<location inheritInChildApplications="false">
<system.web>
<globalization uiCulture="auto" culture="auto" />
<authentication mode="Forms">
<forms loginUrl="~/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.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
<add namespace="DocTrails3.Net.ViewModels" />
</namespaces>
</pages>
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" requestPathInvalidCharacters="<,>,%,&,:,\,?" relaxedUrlToFileSystemMapping="true" maxRequestLength="1048576" />
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
<redirectHeaders>
<clear />
</redirectHeaders>
</httpProtocol>
<modules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
</modules>
</system.webServer>
</location>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Deployment" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<!-- Entity Framework Configuration. -->
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<elmah>
<security allowRemoteAccess="yes" />
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="elmah-sql" applicationName="DocTrails" />
</elmah>
</configuration>
Edit: Added some information about logging
Thanks to the comments on this post, I've double checked in IIS, where the logs are being saved.
The screenshot below shows where the logs are being saved:
According to another post here on SO, I know that the logs could also be found in the following location:
C:\Windows\System32\LogFiles\HTTPERR
So, I've executed a new request, and on the server, again the Just-In-Time Debugger Windows opens for a few times (5 I guess), but in both directories, (the one defined in the screenshot, and the one listed above) there are no files created, nor modified with the same timestamp as the request, so I couldn't find any more information there.
Edit: Added some more information on further investigation
After some further investigation ,I've found out that the problem is not related to HTTPS, since running the website in IIS on the HTTP protocol gives me the same error.
However, the Windows Event Log shows me the following entries:
Faulting application name: w3wp.exe, version: 8.5.9600.16384, time stamp: 0x52157ba0
Faulting module name: clr.dll, version: 4.0.30319.34014, time stamp: 0x52e0b784
Exception code: 0xc00000fd
Fault offset: 0x00003022
Faulting process id: 0xd00
Faulting application start time: 0x01d0452cb0b43b02
Faulting application path: C:\Windows\SysWOW64\inetsrv\w3wp.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Report Id: f1876b51-b11f-11e4-8149-005056a1b9d2
Faulting package full name:
Faulting package-relative application ID:
Kind regards,
After hours and hours of searching, I've found the solution.
The code was running fine on my local computer since the IIS application pool was configured to run 64 bit application. On the server it was configured for running 32 bit applications.
Once I changed it locally to 32 bit, I did receive the StackOverflowException and could start debugging.
It turned out that it was a String object. I've replaced it with a StringBuilder and everything works fine right now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With