HTTP Error 500.23 after adding dotless to my local website - asp.net

Hi I'm trying to run dotless on my local .net4 web site
My web config looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpHandlers><add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" /></httpHandlers></system.web>
<dotless minifyCss="false" cache="true" web="false" />
<system.webServer>
<handlers>
<add name="dotless" path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition="" />
</handlers>
</system.webServer>
</configuration>
Here is the error I get
HTTP Error 500.23 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
Most likely causes:
This application defines configuration in the system.web/httpHandlers section.
Can you please help?

adding <validation validateIntegratedModeConfiguration="false"/> worked
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpHandlers>
<add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" />
</httpHandlers>
</system.web>
<dotless minifyCss="false" cache="true" web="false" />
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="dotless" path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition="" />
</handlers>
</system.webServer>
</configuration>

<validation validateIntegratedModeConfiguration="false"/> tells IIS to ignore configuration issues. One such issue seems to be the fact that dotless automatically adds a handler to system.web and system.webServer. The former section is used by the classic application pool mode, whereas the latter by the new integrated application pool mode. Since I am using the integrated mode, removing the handler in system.web helped just as well.

I had to add <validation validateIntegratedModeConfiguration="false"/> to my webserver section and I also had to move the configSections to be the first element in my Configuration.
<configuration>
<configSections>
<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />

We will add a small piece of code into web.config file. open web.config from your IIS root or change the setting in Visual Studio web.config and publish again.
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>

Related

Stop EPiServer trying to serve requests to my virtual directory

We have a site built in EPiServer and is running on www.mysite.com
Now we have built a small .NET microsite that isn’t part of the EPiServer project that we would like to run as a IIS Virtual Directory www.mysite.com/microsite
At the moment we are seeing 404 being returned for all of the assets on the microsite so www.mysite.com/microsite/assets/js/myjs.js or www.mysite.com/microsite/assets/img/myimg.jpg
The home page of the microsite is served, but with missing assets.Is there a way I can configure the main EPiServer project to ignore all of the requests to my microsites folder structure.
After a while battling this issue we have now got a repeatable solution.
In the parent application (EPiServer solution) we need to add the following location element in the web.config
<location path="MY-IIS-APPLICATION-NAME">
<system.webServer>
<handlers>
<clear />
<add name="wildcard" path="*" verb="*" type="System.Web.StaticFileHandler" />
</handlers>
</system.webServer>
</location>
Then, in the same web.config we wrap the <system.web> and <system.webserver> sections with this element <location path="." inheritInChildApplications="false">
Finally we need to alter the web.config in our IIS-Application to unload the EPiServer handlers and libraries.
So, in the <system.web> section we added these elements
<httpModules>
<clear />
</httpModules>
<httpHandlers>
<clear />
</httpHandlers>
then within the <system.webserver> we make these changes/removals
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
</handlers>
<modules>
<remove name="InitializationModule" />
<remove name="FirstBeginRequestModule" />
<remove name="Initializer" />
<remove name="WorkflowRuntime" />
<remove name="UrlRewriteModule" />
<remove name="ShellRoutingModule" />
<remove name="ContainerDisposal" />
<remove name="PropertyInjection" />
<remove name="AttributedInjection" />
</modules>
There is every chance that this isn't the solution, but in the last few days we have rolled this out to 6 different projects and it has had the desired effect each time.

UrlRewriting.Net not working even with a simple rewrite

I want to make URL rewriting using UrlRewriteNet module.
While I have added all the required config settings, nothing seems to take action even for simple rewrite.
web.config:
<configuration>
<configSections>
<!-- URL Rewriting.NET -->
<section name="urlrewritingnet"
restartOnExternalChanges="true"
requirePermission="false"
type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter" />
</configSections>
<system.web>
<httpModules>
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter"/>
</httpModules>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRewriteModule"/>
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
</modules>
</system.webServer>
<urlrewritingnet
xmlns="http://www.urlrewriting.net/schema/config/2006/07">
<rewrites>
<add name="GeneralRewrite"
virtualUrl="^~/Default.aspx"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/MyDefault.aspx"
ignoreCase="true"
/>
</rewrites>
</urlrewritingnet>
</configuration>
Nothing more is requires as far as I understand to just rewrite the Deafault.aspx page to MyDefault.aspx. So I would expect my URL from https://server.address/Project.SiteName/Default.aspx to simply become https://server.address/Project.SiteName/MyDefault.aspx.
I use development in my local IIS 7 Windows 7 development pc but the release production server will be IIS 6 thats why I included both configuration into the web.config.
Unfortunately, and where there is no error for any reason, checked the IIS and saw that the module is registered in Modules section but the engine never runs !
Is there something that I miss here?
make the above in following manner
<configuration>
<configSections>
<section name="urlrewritingnet"
restartOnExternalChanges="true"
requirePermission ="false"
type="UrlRewritingNet.Configuration.UrlRewriteSection,
UrlRewritingNet.UrlRewriter" />
</configSections>
</configuration>
then comes the rewriting sections to rewrite urls
<urlrewritingnet>
<rewrites>
your urls to rewite will mapped here.....
</rewrites>
</urlrewritingnet>
and finally need to http module which will listen to the requests.
<system.web>
<httpModules>
<add name="UrlRewriteModule"
type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
</httpModules>
</system.web>
Except this no configuration needs to done in web.config just reference the dll (mandatory)
and .xsd file for intellisense
http://blog.vizioz.com/2009/11/add-intellisense-when-using-url.html
Open Web.config and add modules
<configuration>
<system.webserver>
<modules>
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter"/>
<remove name="Session"/>
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
</modules>
</system.webServer>
</configuration>

httpModules not work with iis 7.5 for url rewriting/extention less url (give error 500.0)

I am using URL rewriting with IHttpModule. Application work on local but on server application give error if I written path without extension (aspx).
I had register URL rewriting module in web config like
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="URLRewriteModule" type="URLRewriteModule" preCondition="ManagedHandler" />
</modules>
<defaultDocument>
<files>
<add value="Login.aspx" />
</files>
</defaultDocument>
</system.webServer>
And also ExtensionlessUrlHandler-Integrated-4.0, ExtensionlessUrlHandler-ISAPI-4.0_64bit, ExtensionlessUrlHandler-ISAPI-4.0_32bit handler are there. Then also I am getting following error
HTTP Error 500.0 - Internal Server Error
Module ManagedPipelineHandler
Notification ExecuteRequestHandler
Handler ExtensionlessUrlHandler-Integrated-4.0
Error Code 0x800703e9
I think you have miss a config.
The following is an example, custom http module should be configed both in system.web node and system.webserver node
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpModules>
<add name="CustomHttpModule" type="Routing_Static_Page_Demo.WebModule.CustomHttpModule, Routing_Static_Page_Demo" />
</httpModules>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRoutingModule"/>
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule,
System.Web,
Version=4.0.0.0,
Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
<add name="CustomHttpModule" type="Routing_Static_Page_Demo.WebModule.CustomHttpModule" />
</modules>

URLRewriter rewrites all requests, even for images

I'm using URLRewriter, but there is a problem, it re-write all addresses, even for image URLs, for example, it shows a webpage for http://localhost/images/logo.png.
It's my web.config
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="rewriter"
requirePermission="false"
type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpModules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
</httpModules>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
<rewriter>
<rewrite url="~/pages/(.+)" to="~/default.aspx?pn=$1" />
</rewriter>
</configuration>
I want it re-write only .aspx files.
The url attribute in the rewrite element is a .Net regular expression, at the moment the expression you have matches anything under ~/pages/. If you only want to match .aspx files the simplest thing to do is change it to:
<rewrite url="~/pages/(.+\.aspx)" to="~/default.aspx?pn=$1" />

Problem with ASP.net URL

I want to rewrite:
Test.php to Default.asp
So I use the rule:
<rewrite url="~/Test.php" to="~/default.asp" />
But that rule gives a 404.
However this rule works fine:
<rewrite url="~/default.aspx" to="~/default.asp" />
But this rule 404's:
<rewrite url="~/Test" to="~/default.asp" />
My web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
<section name="rewriter"
requirePermission="false"
type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
</configSections>
<system.web>
<httpModules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
</httpModules>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
<rewriter>
<rewrite url="~/Test.php" to="~/default.asp" />
</rewriter>
</configuration>
What is PHP being handled by?
Per the setup documentation you need to ensure that the PHP extension is being handled by ASP.NET. In addition, if IIS is checking to see if the file exists before handing it off to ASP.NET you'd potentially be missing this as well.
Also, based on your system.webServer addition (which isn't detailed on the module's site), can we assume Server 2008? If so, can I recommend URL Rewrite instead?

Resources