I have set up URL Routing in IIS. When I have the runAllManagedModulesForAllRequests set to true, the URL routing works.
With the following web.config (and runAllManagedModuesForAllRequests set to false) I get a 404:
<system.web>
<compilation defaultLanguage="c#" debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="UrlRoutingHandler" />
<add name="UrlRoutingHandler"
preCondition="integratedMode"
verb="*"
path="UrlRouting.axd"
type="System.Web.HttpForbiddenHandler,
System.Web, Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
<modules>
<remove name="UrlRoutingModule" />
<add name="UrlRoutingModule"
type="System.Web.Routing.UrlRoutingModule,
System.Web.Routing,
Version=3.5.0.0,
Culture=neutral,
PublicKeyToken=31BF3856AD364E35"/>
</modules>
</system.webServer>
How do I set up URL Routing for only certain requests?
I have tested this configuration in IIS 7.5 and IIS 8. This is in a web forms application. All URLs demonstrate the 404 behavior.
"runAllManagedModulesForAllRequests" being true, means that the asp.net handler (of course when you are in integrated mode) will fire for all extensions (including extension-less), if you don't have aspx and it's set to false your module can't process it.
You can't setup for a subset of extensions for what you are trying to achieve, but you can in the module filter it yourself to only handle certain extensions.
Related
I uses asp.net 3.5 for buiding my application,
I use URL routing in it and it works fine in my local host
In my web.config file i do the following setting
<system.web>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="RoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRoutingModule"/>
<add name="UrlRoutingModule"
type="System.Web.Routing.UrlRoutingModule,
System.Web.Routing, Version=3.5.0.0,
Culture=neutral,
PublicKeyToken=31BF3856AD364E35" />
</modules>
<handlers>
<remove name="UrlRoutingHandler"/>
<add name="UrlRoutingHandler"
preCondition="integratedMode"
verb="*" path="UrlRouting.axd"
type="System.Web.HttpForbiddenHandler,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
</system.webServer>
But when i deploy the application on my server which has IIS 7 and windows 2008 r2 then routing doesn't work there.I think i have to do some iis setting or to change some web.config code....
so please anyone suggest me some answer
Have you thought about implementing Page Routing from you web-app?
One problem that you might incur, is if your using AJAX (Toolkit or Extensions) you will need to implement:
'Ignores any Resource cache references, used heavily in AJAX interactions.
rts.Ignore("{resource}.axd/{*pathInfo}")
To keep from getting Sys is undefined errors while debugging.
I'm programming ASP.NET using visual studio 2010 and IIS 7.5
I have URL-rewriting in Global.asax (RouteTable.Routes.MapPageRoute). It works in Development Server but not in IIS.
Is there a configuration for this in IIS?
There's a webconfig for it... You don't need the remove/add part, that's just showing how you'd explicitly only include this module.
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRoutingModule" />
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</modules>
<handlers>
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
</system.webServer>
system.web:
<httpModules>
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpModules>
We are trying to move our reports from Visual 2008 to Visual 2010, but we are not being capable of making ASP.NET ReportViewer control work on our IIS 7.5 machines. The OS is Windows 7.
We have moved all our refernces to Microsoft.Reporting.WebForms 10.0 in code and in config files as well. Our Web.config file is the following sections regarding ReportViewer:
<system.web>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
validate="false" />
</httpHandlers>
<hostingEnvironment shutdownTimeout="30" shadowCopyBinAssemblies="false" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.Shared, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.ReportSource, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
</assemblies>
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
</compilation>
<authentication mode="Windows" />
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
<httpRuntime requestValidationMode="2.0" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add verb="GET" name ="CrystalImageHandler" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</handlers>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4294967295" />
</requestFiltering>
</security>
</system.webServer>
When loading the aspx which contains the ReportViewer control we see only the toolbar of the Report Viewer and the rest of the page is blank. The source code of that page tells the following:
The Report Viewer Web Control HTTP
Handler has not been registered in the
application's web.config file. Add
to
the system.web/httpHandlers section of
the web.config file, or add to
the system.webServer/handlers section
for Internet Information Services 7 or
later.
We know that ReportViewer 10.0 does not work in classic mode and so the application pool is configured to be Integrated. We have tried removing the handles section from the system.web but with no luck.
Anyone could give us a clue of how to get a working configuration of an ASP.NET app with Report Viewer 10.0 over IIS 7.5?
Many thanks in advance.
Jose Antonio Arroba
We had a similar problem when moving our web page from IIS6.0 to IIS7.5 we had to move our httpH andlers from to see code sample below
<defaultDocument>
<files>
<add value="home.aspx" />
</files>
</defaultDocument>
<modules>
<add name="AccessDeniedModule" type="Senate.Leagis.Web.Common.Handlers.AccessDeniedModule, Senate.Leagis.Web, Culture=neutral, PublicKeyToken=132b49799d170825" />
</modules>
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
Had the same issue this morning. It looks like your web.config handlers are fine. Hint: if you need to know they are not fine, try viewing with chrome. It tended to show me error messages IE wasn't. Anyways, I solved my problem by adding an HTTP-Handler to my IIS7.5 In IIS manager, go to Handler Mappings and register the handler. Request Path:Reserved.ReportViewerWebControl.axd, Type select the correct version, click on Request Restrictions and specify "One of the following verbs" as GET,HEAD,POST,DEBUG
You might find the ending part of here useful
Try to add
<configuration>
<system.webServer>
<handlers>
<add name="Reserved-ReportViewerWebControl-axd" path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler" resourceType="Unspecified" />
.......
in web.config
Source
I'm using asp.net 4 routing in one of our new product and it works fine in the development environment (Visual studio webserver). but when i moved it to remote iis for testing purpose it doesn't work. all i get is 404 error page. i tried adding the following to the web.config and still getting the error.
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
any ideas how to sort this issue?.
i got the solution for this ... add the below code in ur web.config ..
and dont forget to add runAllManagedModulesForAllRequests="true" in your module..
<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" />
</modules>
<handlers>
<add
name="UrlRoutingHandler"
preCondition="integratedMode"
verb="*" path="UrlRouting.axd"
type="System.Web.HttpForbiddenHandler, System.Web,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
</handlers>
</system.webServer>
Note: You have to set Application Pool to Asp.net 4.0 application pool , as routing is not working with Asp.net 4.0 Classic Application pool.
After deployment of my website to IIS, I'm getting the following error message when trying to access a session:
Session state can only be used when
enableSessionState is set to true,
either in a configuration file or in
the Page directive. Please also make
sure that
System.Web.SessionStateModule or a
custom session state module is
included in the
\\
section in the application
configuration.
I access it in Page_Load or PreRender events (I tried both versions). With Visual Studio Dev Server it works without a problem. I tried both InProc an SessionState storage, 1 and multiple worker processes. I added a enableSessionState = "true" to my webpage explicitly.
Here is part of web.config:
<system.web>
<globalization culture="ru-RU" uiCulture="ru-RU" />
<compilation debug="true" defaultLanguage="c#">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
</compilation>
<pages enableEventValidation="false" enableSessionState="true">
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</controls>
</pages>
<httpHandlers>
<remove verb="*" path="*.asmx" />
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="SearchUrlRewriter" type="Synonymizer.SearchUrlRewriter, Synonymizer, Version=1.0.0.0, Culture=neutral" />
<add name="Session" type="System.Web.SessionStateModule" />
</httpModules>
<sessionState cookieless="UseCookies" cookieName="My_SessionId" mode="InProc" stateNetworkTimeout="5" />
<customErrors mode="Off" />
</system.web>
What else do I need to do to make it work?
I tried to monitor if IIS accesses the aspnet_client folder with Process Monitor and didn't get any access.
The solution happened to be very curious. Though IIS7 jn WIndows 2008R2 in error description says to add SessionStateModule to system.web section, it should be added to system.webServer section.
<system.webServer>
<modules>
<remove name="Session" />
<add name="Session" type="System.Web.SessionState.SessionStateModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</modules>
</system.webServer>
Sessions should work on a plain, empty application. That is, all the default values should work.
If it's not working with basic test applications, then IIS may have got confused with your application.
Try deleting your IIS application. Then create a new virtual directory, restart IIS, and then add your application again.
Also, double check your application's ASP.Net settings. Make sure it's set to the correct version of ASP.Net.
While searching, I also ran into...
http://ramonaeid.spaces.live.com/blog/cns!A77704F1DB999BB0!181.entry
Hope that helps.
Make sure that the service names "ASP.NET State Service" is running and then add this to your web.config.
<sessionState mode="InProc" server="127.0.0.1" port="42424" ... >
Reference:
http://msdn.microsoft.com/en-us/library/ms972429.aspx
http://msdn.microsoft.com/en-us/library/h6bb9cz9(VS.71).aspx
Comment:
Maybe is better to manual change the port to something else. This can be done with regedit.
HKLM\Syste\CurrentControlSet\Services\aspnet_state\Parametres\Port -> 42424
Some more infos:
http://msdn.microsoft.com/en-us/library/ff648667.aspx
Has this particular server been used for anything else? Is it a Windows 2008 server and IIS7?
I'm willing to bet that you're missing some server roles for IIS, have you checked those by right clicking "Computer", choosing "Manage", going to the roles management (it's on the primary tree in computer manager) and checking the installed bits for IIS?
If this is IIS6 then you may have other concerns. But I figure we'll start with something simple, see if we can't help you figure this one out.
What is your folder structure. Do you have web configs at a higher folder that may have explicitly disabled this?
If possible, reregister asp.net
Open Control Panel
Programs\Turn Windows Features on or off
Internet Information Services
World Wide Web Services
Application development Features
ASP.Net <-- check mark here
ref: How to register ASP.NET 2.0 to web server(IIS7)?
Try adding in pages section in web.config the following section:
<namespaces>
<add namespace="System.Web.SessionState" />
<namespaces/>