Routing in ASP.Net 4 and IIS
I have implemented the solution applied below and when I run my website from visual studio 2010 it works fine, the routed requests all work perfectly.
http://erraticdev.blogspot.com/2011/...module-to.html
However once deployed to the server running on IIS7 the routing no longer seems to work and I end up with a 404 page not found error.
I have web config set up as below.
HTML Code:
<httpModules>
<add name="RegistratorModule" type="RegistratorModule"/>
</httpModules>
<httpRuntime requestValidationMode="2.0"/>
</system.web>
And I have changed the application pool to classic mode. I have also stopped and started the application pool.
Anyone got any ideas what else I could do to try get this working on the server?
I am not sure that the custom module is running when the web server is started, I put the following code in my route mapping method and nothing is getting written to the log.
Code:
string sSource;
string sLog;
string sEvent;
sSource = "Registering Routes";
sLog = "Application";
sEvent = "GSP Event";
if (!EventLog.SourceExists(sSource))
EventLog.CreateEventSource(sSource, sLog);
EventLog.WriteEntry(sSource, sEvent);
EventLog.WriteEntry(sSource, sEvent,
EventLogEntryType.Warning, 234);
More strangely if I change the IIS application pool mode to integrated
and register the module as below I get Event code: 4010
Event message: An unhandled security exception has occurred.
Code:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="RegistratorModule" type="RegistratorModule"/>
</modules>
Re: Routing in ASP.Net 4 and IIS
Ok I removed the attempt to write to the application log, apparently that just needed permission to create a new source setting up in the registry. I decided against it alltogether.
I set the web config to debug true and realised the module was running but my routing problem was different.
I now have routing working hooray! by modifying the web config as below.
<modules runAllManagedModulesForAllRequests="true">
however this has now created another problem, none of the javascript/ajax now seems to be working, is there anything special I also need to configure?
[Update] This problem only occurs locally, if I access the site externally it is fine. Any ideas on this problem?