Adding Custom IHttpModule to web.config throws 500 error
I have been struggling with this very basic issue all day. Long term I am trying to keep .NETs Forms Authentication, but replace the default Authorization module with a custom one.
However, before I get there, I just need my custom IHttpModule to get called.
I copied this code off of the net as a basic template to get started:
public class UrlAuthorizationModule : IHttpModule
public void Init(HttpApplication context)
context.AuthenticateRequest += new EventHandler(context_AuthenticateRequest);
context.AuthorizeRequest += new EventHandler(context_AuthorizeRequest);
void context_AuthenticateRequest(object sender, EventArgs e)
var sting = "";
void context_AuthorizeRequest(object sender, EventArgs e)
HttpApplication context = (HttpApplication)sender;
if (context.Request.Url.AbsoluteUri.Contains("Oregon"))
return;
else
throw new UnauthorizedAccessException();
//if (context.User != null && context.User.Identity.IsAuthenticated)
//
// HttpContext _httpContext = context.Context;
// SiteMapNode node = SiteMap.Provider.FindSiteMapNode(_httpContext);
// if (node == null)
// throw new UnauthorizedAccessException();
//
public void Dispose()
And I put this into the web.config:
<system.web>
<httpModules>
<remove name="UrlAuthorization" />
<add name="UrlAuthorizationModule" type="MyNamespace.UrlAuthorizationModule, common" />
However it was not getting called at all. Nothing was happening. Then I realized that I was probably using iis7, so I added this:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorization" />
<add name="UrlAuthorizationModule" type="MyNamespace.UrlAuthorizationModule, common" />
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v17.2, Version=17.2.5.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A" name="ASPxHttpHandlerModule" />
Unfortunately, as soon as I add the "add" customtag inside the system.webServer/modules then the site will not load at all. Instead it throws a generic 500 error.
Server Error
500 - Internal server error.
There is a problem with the resource you are looking for, and it
cannot be displayed.
As near as I can tell my syntax is all correct. The DevExpress custom module is working correctly and no errors get thrown because of it, so I know it is my additions that are causing problems. If I delete my "add" line then the site loads correctly, it just does not call my custom IHttpModule.
Nothing is showing up in the System log either. It has got to be something really stupid, I just do not see it.
EDIT:
I am using Microsoft Visual Studio 2017 (which uses IISExpress) on my local win 10 dev machine. I did find some TraceLogFiles at: C:UsersusernameDocumentsIISExpressTraceLogFileswebsitefr000001.xml and inside that was this error.
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>3</Level>
<Opcode>16</Opcode>
<Keywords>0x100</Keywords>
<TimeCreated SystemTime="2018-11-13T15:25:30.609Z"/>
<Correlation ActivityID="80001795-0008-FD00-B63F-84710C7967BB"/>
<Execution ProcessID="41168" ThreadID="40824"/>
<Computer>machine name</Computer>
</System>
<EventData>
<Data Name="ContextId">80001795-0008-FD00-B63F-84710C7967BB</Data>
<Data Name="ModuleName">IIS Web Core</Data>
<Data Name="Notification">1</Data>
<Data Name="HttpStatus">500</Data>
<Data Name="HttpReason">Internal Server Error</Data>
<Data Name="HttpSubStatus">19</Data>
<Data Name="ErrorCode">2147942433</Data>
<Data Name="ConfigExceptionInfo">\?C:UsersusernameDocumentswebsitepathweb.config ( 394) :Lock violation
</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>MODULE_SET_RESPONSE_ERROR_STATUS</Opcode>
<Keywords>
<Keyword>RequestNotifications</Keyword>
</Keywords>
<freb:Description Data="Notification">BEGIN_REQUEST</freb:Description>
<freb:Description Data="ErrorCode">The process cannot access the file because another process has locked a portion of the file.
(0x80070021)</freb:Description>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>002E91E3-E7AE-44AB-8E07-99230FFA6ADE</EventGuid>
</ExtendedTracingInfo>
</Event>
As near as I can tell, it is complaining that the web.config file is being locked by another process. But that does not make sense. Just to be safe I changed the dev port I was working on to a new random number from the old random number I was using, and it had no affect. Considering the site works without the custom module, that means the web.config files base permissions are ok.
.net iis-7 httpmodule
add a comment |
I have been struggling with this very basic issue all day. Long term I am trying to keep .NETs Forms Authentication, but replace the default Authorization module with a custom one.
However, before I get there, I just need my custom IHttpModule to get called.
I copied this code off of the net as a basic template to get started:
public class UrlAuthorizationModule : IHttpModule
public void Init(HttpApplication context)
context.AuthenticateRequest += new EventHandler(context_AuthenticateRequest);
context.AuthorizeRequest += new EventHandler(context_AuthorizeRequest);
void context_AuthenticateRequest(object sender, EventArgs e)
var sting = "";
void context_AuthorizeRequest(object sender, EventArgs e)
HttpApplication context = (HttpApplication)sender;
if (context.Request.Url.AbsoluteUri.Contains("Oregon"))
return;
else
throw new UnauthorizedAccessException();
//if (context.User != null && context.User.Identity.IsAuthenticated)
//
// HttpContext _httpContext = context.Context;
// SiteMapNode node = SiteMap.Provider.FindSiteMapNode(_httpContext);
// if (node == null)
// throw new UnauthorizedAccessException();
//
public void Dispose()
And I put this into the web.config:
<system.web>
<httpModules>
<remove name="UrlAuthorization" />
<add name="UrlAuthorizationModule" type="MyNamespace.UrlAuthorizationModule, common" />
However it was not getting called at all. Nothing was happening. Then I realized that I was probably using iis7, so I added this:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorization" />
<add name="UrlAuthorizationModule" type="MyNamespace.UrlAuthorizationModule, common" />
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v17.2, Version=17.2.5.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A" name="ASPxHttpHandlerModule" />
Unfortunately, as soon as I add the "add" customtag inside the system.webServer/modules then the site will not load at all. Instead it throws a generic 500 error.
Server Error
500 - Internal server error.
There is a problem with the resource you are looking for, and it
cannot be displayed.
As near as I can tell my syntax is all correct. The DevExpress custom module is working correctly and no errors get thrown because of it, so I know it is my additions that are causing problems. If I delete my "add" line then the site loads correctly, it just does not call my custom IHttpModule.
Nothing is showing up in the System log either. It has got to be something really stupid, I just do not see it.
EDIT:
I am using Microsoft Visual Studio 2017 (which uses IISExpress) on my local win 10 dev machine. I did find some TraceLogFiles at: C:UsersusernameDocumentsIISExpressTraceLogFileswebsitefr000001.xml and inside that was this error.
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>3</Level>
<Opcode>16</Opcode>
<Keywords>0x100</Keywords>
<TimeCreated SystemTime="2018-11-13T15:25:30.609Z"/>
<Correlation ActivityID="80001795-0008-FD00-B63F-84710C7967BB"/>
<Execution ProcessID="41168" ThreadID="40824"/>
<Computer>machine name</Computer>
</System>
<EventData>
<Data Name="ContextId">80001795-0008-FD00-B63F-84710C7967BB</Data>
<Data Name="ModuleName">IIS Web Core</Data>
<Data Name="Notification">1</Data>
<Data Name="HttpStatus">500</Data>
<Data Name="HttpReason">Internal Server Error</Data>
<Data Name="HttpSubStatus">19</Data>
<Data Name="ErrorCode">2147942433</Data>
<Data Name="ConfigExceptionInfo">\?C:UsersusernameDocumentswebsitepathweb.config ( 394) :Lock violation
</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>MODULE_SET_RESPONSE_ERROR_STATUS</Opcode>
<Keywords>
<Keyword>RequestNotifications</Keyword>
</Keywords>
<freb:Description Data="Notification">BEGIN_REQUEST</freb:Description>
<freb:Description Data="ErrorCode">The process cannot access the file because another process has locked a portion of the file.
(0x80070021)</freb:Description>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>002E91E3-E7AE-44AB-8E07-99230FFA6ADE</EventGuid>
</ExtendedTracingInfo>
</Event>
As near as I can tell, it is complaining that the web.config file is being locked by another process. But that does not make sense. Just to be safe I changed the dev port I was working on to a new random number from the old random number I was using, and it had no affect. Considering the site works without the custom module, that means the web.config files base permissions are ok.
.net iis-7 httpmodule
1
Use failed request tracing to see who gives you 500 first, docs.microsoft.com/en-us/iis/troubleshoot/…
– Lex Li
Nov 9 at 23:22
I am using IISEspress on my local win 10 dev machine, and do not see anyway to follow those directions. I did find some TraceLogFiles at: C:UsersusernameDocumentsIISExpressTraceLogFileswebsitefr000001.xml and inside that was the error BEGIN_REQUEST The process cannot access the file because another process has locked a portion of the file.
– Jereme Guenther
Nov 13 at 16:17
Also, those directions do not indicate how to view the logs, which seem to be generated in XML format. Is there a good viewer available somewhere?
– Jereme Guenther
Nov 13 at 16:29
jexusmanager.com Jexus Manager can be used to configure FRT for IIS Express. To view FRT log, simply open the XML file in a browser like IE, which is smart enough to load the XSDT file in the same folder and render the trace in the standard way.
– Lex Li
Nov 13 at 19:29
add a comment |
I have been struggling with this very basic issue all day. Long term I am trying to keep .NETs Forms Authentication, but replace the default Authorization module with a custom one.
However, before I get there, I just need my custom IHttpModule to get called.
I copied this code off of the net as a basic template to get started:
public class UrlAuthorizationModule : IHttpModule
public void Init(HttpApplication context)
context.AuthenticateRequest += new EventHandler(context_AuthenticateRequest);
context.AuthorizeRequest += new EventHandler(context_AuthorizeRequest);
void context_AuthenticateRequest(object sender, EventArgs e)
var sting = "";
void context_AuthorizeRequest(object sender, EventArgs e)
HttpApplication context = (HttpApplication)sender;
if (context.Request.Url.AbsoluteUri.Contains("Oregon"))
return;
else
throw new UnauthorizedAccessException();
//if (context.User != null && context.User.Identity.IsAuthenticated)
//
// HttpContext _httpContext = context.Context;
// SiteMapNode node = SiteMap.Provider.FindSiteMapNode(_httpContext);
// if (node == null)
// throw new UnauthorizedAccessException();
//
public void Dispose()
And I put this into the web.config:
<system.web>
<httpModules>
<remove name="UrlAuthorization" />
<add name="UrlAuthorizationModule" type="MyNamespace.UrlAuthorizationModule, common" />
However it was not getting called at all. Nothing was happening. Then I realized that I was probably using iis7, so I added this:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorization" />
<add name="UrlAuthorizationModule" type="MyNamespace.UrlAuthorizationModule, common" />
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v17.2, Version=17.2.5.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A" name="ASPxHttpHandlerModule" />
Unfortunately, as soon as I add the "add" customtag inside the system.webServer/modules then the site will not load at all. Instead it throws a generic 500 error.
Server Error
500 - Internal server error.
There is a problem with the resource you are looking for, and it
cannot be displayed.
As near as I can tell my syntax is all correct. The DevExpress custom module is working correctly and no errors get thrown because of it, so I know it is my additions that are causing problems. If I delete my "add" line then the site loads correctly, it just does not call my custom IHttpModule.
Nothing is showing up in the System log either. It has got to be something really stupid, I just do not see it.
EDIT:
I am using Microsoft Visual Studio 2017 (which uses IISExpress) on my local win 10 dev machine. I did find some TraceLogFiles at: C:UsersusernameDocumentsIISExpressTraceLogFileswebsitefr000001.xml and inside that was this error.
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>3</Level>
<Opcode>16</Opcode>
<Keywords>0x100</Keywords>
<TimeCreated SystemTime="2018-11-13T15:25:30.609Z"/>
<Correlation ActivityID="80001795-0008-FD00-B63F-84710C7967BB"/>
<Execution ProcessID="41168" ThreadID="40824"/>
<Computer>machine name</Computer>
</System>
<EventData>
<Data Name="ContextId">80001795-0008-FD00-B63F-84710C7967BB</Data>
<Data Name="ModuleName">IIS Web Core</Data>
<Data Name="Notification">1</Data>
<Data Name="HttpStatus">500</Data>
<Data Name="HttpReason">Internal Server Error</Data>
<Data Name="HttpSubStatus">19</Data>
<Data Name="ErrorCode">2147942433</Data>
<Data Name="ConfigExceptionInfo">\?C:UsersusernameDocumentswebsitepathweb.config ( 394) :Lock violation
</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>MODULE_SET_RESPONSE_ERROR_STATUS</Opcode>
<Keywords>
<Keyword>RequestNotifications</Keyword>
</Keywords>
<freb:Description Data="Notification">BEGIN_REQUEST</freb:Description>
<freb:Description Data="ErrorCode">The process cannot access the file because another process has locked a portion of the file.
(0x80070021)</freb:Description>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>002E91E3-E7AE-44AB-8E07-99230FFA6ADE</EventGuid>
</ExtendedTracingInfo>
</Event>
As near as I can tell, it is complaining that the web.config file is being locked by another process. But that does not make sense. Just to be safe I changed the dev port I was working on to a new random number from the old random number I was using, and it had no affect. Considering the site works without the custom module, that means the web.config files base permissions are ok.
.net iis-7 httpmodule
I have been struggling with this very basic issue all day. Long term I am trying to keep .NETs Forms Authentication, but replace the default Authorization module with a custom one.
However, before I get there, I just need my custom IHttpModule to get called.
I copied this code off of the net as a basic template to get started:
public class UrlAuthorizationModule : IHttpModule
public void Init(HttpApplication context)
context.AuthenticateRequest += new EventHandler(context_AuthenticateRequest);
context.AuthorizeRequest += new EventHandler(context_AuthorizeRequest);
void context_AuthenticateRequest(object sender, EventArgs e)
var sting = "";
void context_AuthorizeRequest(object sender, EventArgs e)
HttpApplication context = (HttpApplication)sender;
if (context.Request.Url.AbsoluteUri.Contains("Oregon"))
return;
else
throw new UnauthorizedAccessException();
//if (context.User != null && context.User.Identity.IsAuthenticated)
//
// HttpContext _httpContext = context.Context;
// SiteMapNode node = SiteMap.Provider.FindSiteMapNode(_httpContext);
// if (node == null)
// throw new UnauthorizedAccessException();
//
public void Dispose()
And I put this into the web.config:
<system.web>
<httpModules>
<remove name="UrlAuthorization" />
<add name="UrlAuthorizationModule" type="MyNamespace.UrlAuthorizationModule, common" />
However it was not getting called at all. Nothing was happening. Then I realized that I was probably using iis7, so I added this:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorization" />
<add name="UrlAuthorizationModule" type="MyNamespace.UrlAuthorizationModule, common" />
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v17.2, Version=17.2.5.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A" name="ASPxHttpHandlerModule" />
Unfortunately, as soon as I add the "add" customtag inside the system.webServer/modules then the site will not load at all. Instead it throws a generic 500 error.
Server Error
500 - Internal server error.
There is a problem with the resource you are looking for, and it
cannot be displayed.
As near as I can tell my syntax is all correct. The DevExpress custom module is working correctly and no errors get thrown because of it, so I know it is my additions that are causing problems. If I delete my "add" line then the site loads correctly, it just does not call my custom IHttpModule.
Nothing is showing up in the System log either. It has got to be something really stupid, I just do not see it.
EDIT:
I am using Microsoft Visual Studio 2017 (which uses IISExpress) on my local win 10 dev machine. I did find some TraceLogFiles at: C:UsersusernameDocumentsIISExpressTraceLogFileswebsitefr000001.xml and inside that was this error.
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>3</Level>
<Opcode>16</Opcode>
<Keywords>0x100</Keywords>
<TimeCreated SystemTime="2018-11-13T15:25:30.609Z"/>
<Correlation ActivityID="80001795-0008-FD00-B63F-84710C7967BB"/>
<Execution ProcessID="41168" ThreadID="40824"/>
<Computer>machine name</Computer>
</System>
<EventData>
<Data Name="ContextId">80001795-0008-FD00-B63F-84710C7967BB</Data>
<Data Name="ModuleName">IIS Web Core</Data>
<Data Name="Notification">1</Data>
<Data Name="HttpStatus">500</Data>
<Data Name="HttpReason">Internal Server Error</Data>
<Data Name="HttpSubStatus">19</Data>
<Data Name="ErrorCode">2147942433</Data>
<Data Name="ConfigExceptionInfo">\?C:UsersusernameDocumentswebsitepathweb.config ( 394) :Lock violation
</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>MODULE_SET_RESPONSE_ERROR_STATUS</Opcode>
<Keywords>
<Keyword>RequestNotifications</Keyword>
</Keywords>
<freb:Description Data="Notification">BEGIN_REQUEST</freb:Description>
<freb:Description Data="ErrorCode">The process cannot access the file because another process has locked a portion of the file.
(0x80070021)</freb:Description>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>002E91E3-E7AE-44AB-8E07-99230FFA6ADE</EventGuid>
</ExtendedTracingInfo>
</Event>
As near as I can tell, it is complaining that the web.config file is being locked by another process. But that does not make sense. Just to be safe I changed the dev port I was working on to a new random number from the old random number I was using, and it had no affect. Considering the site works without the custom module, that means the web.config files base permissions are ok.
.net iis-7 httpmodule
.net iis-7 httpmodule
edited Nov 15 at 22:10
asked Nov 9 at 22:40
Jereme Guenther
177212
177212
1
Use failed request tracing to see who gives you 500 first, docs.microsoft.com/en-us/iis/troubleshoot/…
– Lex Li
Nov 9 at 23:22
I am using IISEspress on my local win 10 dev machine, and do not see anyway to follow those directions. I did find some TraceLogFiles at: C:UsersusernameDocumentsIISExpressTraceLogFileswebsitefr000001.xml and inside that was the error BEGIN_REQUEST The process cannot access the file because another process has locked a portion of the file.
– Jereme Guenther
Nov 13 at 16:17
Also, those directions do not indicate how to view the logs, which seem to be generated in XML format. Is there a good viewer available somewhere?
– Jereme Guenther
Nov 13 at 16:29
jexusmanager.com Jexus Manager can be used to configure FRT for IIS Express. To view FRT log, simply open the XML file in a browser like IE, which is smart enough to load the XSDT file in the same folder and render the trace in the standard way.
– Lex Li
Nov 13 at 19:29
add a comment |
1
Use failed request tracing to see who gives you 500 first, docs.microsoft.com/en-us/iis/troubleshoot/…
– Lex Li
Nov 9 at 23:22
I am using IISEspress on my local win 10 dev machine, and do not see anyway to follow those directions. I did find some TraceLogFiles at: C:UsersusernameDocumentsIISExpressTraceLogFileswebsitefr000001.xml and inside that was the error BEGIN_REQUEST The process cannot access the file because another process has locked a portion of the file.
– Jereme Guenther
Nov 13 at 16:17
Also, those directions do not indicate how to view the logs, which seem to be generated in XML format. Is there a good viewer available somewhere?
– Jereme Guenther
Nov 13 at 16:29
jexusmanager.com Jexus Manager can be used to configure FRT for IIS Express. To view FRT log, simply open the XML file in a browser like IE, which is smart enough to load the XSDT file in the same folder and render the trace in the standard way.
– Lex Li
Nov 13 at 19:29
1
1
Use failed request tracing to see who gives you 500 first, docs.microsoft.com/en-us/iis/troubleshoot/…
– Lex Li
Nov 9 at 23:22
Use failed request tracing to see who gives you 500 first, docs.microsoft.com/en-us/iis/troubleshoot/…
– Lex Li
Nov 9 at 23:22
I am using IISEspress on my local win 10 dev machine, and do not see anyway to follow those directions. I did find some TraceLogFiles at: C:UsersusernameDocumentsIISExpressTraceLogFileswebsitefr000001.xml and inside that was the error BEGIN_REQUEST The process cannot access the file because another process has locked a portion of the file.
– Jereme Guenther
Nov 13 at 16:17
I am using IISEspress on my local win 10 dev machine, and do not see anyway to follow those directions. I did find some TraceLogFiles at: C:UsersusernameDocumentsIISExpressTraceLogFileswebsitefr000001.xml and inside that was the error BEGIN_REQUEST The process cannot access the file because another process has locked a portion of the file.
– Jereme Guenther
Nov 13 at 16:17
Also, those directions do not indicate how to view the logs, which seem to be generated in XML format. Is there a good viewer available somewhere?
– Jereme Guenther
Nov 13 at 16:29
Also, those directions do not indicate how to view the logs, which seem to be generated in XML format. Is there a good viewer available somewhere?
– Jereme Guenther
Nov 13 at 16:29
jexusmanager.com Jexus Manager can be used to configure FRT for IIS Express. To view FRT log, simply open the XML file in a browser like IE, which is smart enough to load the XSDT file in the same folder and render the trace in the standard way.
– Lex Li
Nov 13 at 19:29
jexusmanager.com Jexus Manager can be used to configure FRT for IIS Express. To view FRT log, simply open the XML file in a browser like IE, which is smart enough to load the XSDT file in the same folder and render the trace in the standard way.
– Lex Li
Nov 13 at 19:29
add a comment |
1 Answer
1
active
oldest
votes
I managed to find the answer in this post.
For some reason, the "remove" tag inside of modules:
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorization" />
</modules>
is not allowed inside of system.webServer anymore. And the error thrown is not super great. As soon as I removed that tag (leaving the two custom add tags) the site started at least displaying again.
This post pointed me to the applicationhost.config file where I was able to modify
$(solutionDir).vsconfigapplicationhost.config
<add name="UrlAuthorizationModule" lockItem="true" />
and replace it with
<add name="UrlAuthorizationModule" lockItem="false" />
Then I was able to use the remove tag in my local web.config successfully.
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorizationModule" />
</modules>
A side note on this. Even once I got the custom module working, I was still having invalid pages re-direct to my login page. It took me awhile to realize that some other module (other than the default authentication and authorization modules) is responsible for re-directing 404 errors to the login page.
– Jereme Guenther
Nov 13 at 22:04
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53234175%2fadding-custom-ihttpmodule-to-web-config-throws-500-error%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I managed to find the answer in this post.
For some reason, the "remove" tag inside of modules:
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorization" />
</modules>
is not allowed inside of system.webServer anymore. And the error thrown is not super great. As soon as I removed that tag (leaving the two custom add tags) the site started at least displaying again.
This post pointed me to the applicationhost.config file where I was able to modify
$(solutionDir).vsconfigapplicationhost.config
<add name="UrlAuthorizationModule" lockItem="true" />
and replace it with
<add name="UrlAuthorizationModule" lockItem="false" />
Then I was able to use the remove tag in my local web.config successfully.
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorizationModule" />
</modules>
A side note on this. Even once I got the custom module working, I was still having invalid pages re-direct to my login page. It took me awhile to realize that some other module (other than the default authentication and authorization modules) is responsible for re-directing 404 errors to the login page.
– Jereme Guenther
Nov 13 at 22:04
add a comment |
I managed to find the answer in this post.
For some reason, the "remove" tag inside of modules:
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorization" />
</modules>
is not allowed inside of system.webServer anymore. And the error thrown is not super great. As soon as I removed that tag (leaving the two custom add tags) the site started at least displaying again.
This post pointed me to the applicationhost.config file where I was able to modify
$(solutionDir).vsconfigapplicationhost.config
<add name="UrlAuthorizationModule" lockItem="true" />
and replace it with
<add name="UrlAuthorizationModule" lockItem="false" />
Then I was able to use the remove tag in my local web.config successfully.
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorizationModule" />
</modules>
A side note on this. Even once I got the custom module working, I was still having invalid pages re-direct to my login page. It took me awhile to realize that some other module (other than the default authentication and authorization modules) is responsible for re-directing 404 errors to the login page.
– Jereme Guenther
Nov 13 at 22:04
add a comment |
I managed to find the answer in this post.
For some reason, the "remove" tag inside of modules:
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorization" />
</modules>
is not allowed inside of system.webServer anymore. And the error thrown is not super great. As soon as I removed that tag (leaving the two custom add tags) the site started at least displaying again.
This post pointed me to the applicationhost.config file where I was able to modify
$(solutionDir).vsconfigapplicationhost.config
<add name="UrlAuthorizationModule" lockItem="true" />
and replace it with
<add name="UrlAuthorizationModule" lockItem="false" />
Then I was able to use the remove tag in my local web.config successfully.
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorizationModule" />
</modules>
I managed to find the answer in this post.
For some reason, the "remove" tag inside of modules:
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorization" />
</modules>
is not allowed inside of system.webServer anymore. And the error thrown is not super great. As soon as I removed that tag (leaving the two custom add tags) the site started at least displaying again.
This post pointed me to the applicationhost.config file where I was able to modify
$(solutionDir).vsconfigapplicationhost.config
<add name="UrlAuthorizationModule" lockItem="true" />
and replace it with
<add name="UrlAuthorizationModule" lockItem="false" />
Then I was able to use the remove tag in my local web.config successfully.
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlAuthorizationModule" />
</modules>
edited Nov 13 at 17:45
answered Nov 13 at 17:21
Jereme Guenther
177212
177212
A side note on this. Even once I got the custom module working, I was still having invalid pages re-direct to my login page. It took me awhile to realize that some other module (other than the default authentication and authorization modules) is responsible for re-directing 404 errors to the login page.
– Jereme Guenther
Nov 13 at 22:04
add a comment |
A side note on this. Even once I got the custom module working, I was still having invalid pages re-direct to my login page. It took me awhile to realize that some other module (other than the default authentication and authorization modules) is responsible for re-directing 404 errors to the login page.
– Jereme Guenther
Nov 13 at 22:04
A side note on this. Even once I got the custom module working, I was still having invalid pages re-direct to my login page. It took me awhile to realize that some other module (other than the default authentication and authorization modules) is responsible for re-directing 404 errors to the login page.
– Jereme Guenther
Nov 13 at 22:04
A side note on this. Even once I got the custom module working, I was still having invalid pages re-direct to my login page. It took me awhile to realize that some other module (other than the default authentication and authorization modules) is responsible for re-directing 404 errors to the login page.
– Jereme Guenther
Nov 13 at 22:04
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53234175%2fadding-custom-ihttpmodule-to-web-config-throws-500-error%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Use failed request tracing to see who gives you 500 first, docs.microsoft.com/en-us/iis/troubleshoot/…
– Lex Li
Nov 9 at 23:22
I am using IISEspress on my local win 10 dev machine, and do not see anyway to follow those directions. I did find some TraceLogFiles at: C:UsersusernameDocumentsIISExpressTraceLogFileswebsitefr000001.xml and inside that was the error BEGIN_REQUEST The process cannot access the file because another process has locked a portion of the file.
– Jereme Guenther
Nov 13 at 16:17
Also, those directions do not indicate how to view the logs, which seem to be generated in XML format. Is there a good viewer available somewhere?
– Jereme Guenther
Nov 13 at 16:29
jexusmanager.com Jexus Manager can be used to configure FRT for IIS Express. To view FRT log, simply open the XML file in a browser like IE, which is smart enough to load the XSDT file in the same folder and render the trace in the standard way.
– Lex Li
Nov 13 at 19:29