I have a Project, where I want to use the asp.net Routing function. Therefore I added some routes in my global.asax Application_start.
This works fine on my Windows 7 SP1, but when I deploy the Application to my W2K8 R2 Live Server I only get 404's when using the URLs. If I add a /default.aspx at the end of the URLs the pages get displayt correctly.
The IIS seems to ignore the URLs without a file extension.
Working on Local Server but 404 on Live server:
http://website/list/123/Test
Working on both Servers:
http://website/list/123/Test/index.aspx
How can I get the Live server to use the extension less urls?
Don't forget to add the following in your web.config file
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
Related
I have taken over the maintenance of a production website at a new job that is written in ASP.NET 4 Webforms and that runs on IIS 6 on Windows Server 2003. I am not familiar with Webforms nor managing IIS...so I am kind of working things out as I go here.
I have done several deployments to our production server which have worked fine, but am now setting up a test environment that is identical, just a different IP address/domain, so we can properly test changes first.
I have a problem where on this test site any URL that does NOT end with a reference to a file (always .aspx on this site) will return a 403 error on this server. For example http://users.test.oursite.com/admin will always return a 403 error when logged into the site. It should be redirecting to http://users.test.oursite.com/admin/organisation.aspx. Having an MVC background I am not even sure how this happens...but it does in production.
Browsing links within the site is fine as they always reference an .aspx file. Manually typing URLS that reference an .aspx file is fine, just not when the URL does not contain a file. This is not a problem on the production server.
As I said, I am not familiar with WebForms or managing IIS itself...so I have kind of run out of places to look.
Is there anything that comes to mind that I should be looking at that could be causing this problem?
In WebForms typically there is no routing involved.
You need to either provide a full path on the URL ending with .aspx OR
setup default documents for your website. (Index.aspx, Default.aspx etc.)
http://www.iis.net/configreference/system.webserver/defaultdocument
OR
<configuration>
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="home.html" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
Default documents can be setup in IIS Properties or via web.config.
Otherwise you need to provide the full path.
And because you haven't setup the DirectoryBrowsing (in IIS), you get a 403 Error when you try to access the Directory.
Enable the Directory Browsing option in IIS (not recommended) if you want this error to go away.
We are using Intelligencia UrlRewriter. All URL rewriting logic works perfectly fine on local machine using the built in visual studio server but fails on the live server. Live server has IIS 7 and Windows server 2008 Enterprise.
All rewritten urls give 404 error. If we request the aspx page with proper query strings it works.
Any special settings we need to do,check?
You need to configure your web.config file for IIS settings like:
<system.webServer>
<modules runAllManagedModulesForAllRequests=”true”>
<add name=”UrlRewriter” type=”Intelligencia.UrlRewriter.RewriterHttpModule” />
</modules>
<validation validateIntegratedModeConfiguration=”false” />
</system.webServer>
Please put this code block somewhere under <configuration> section.
I hope this will answer your question. If yes, please mark as "answered".
In my web.config, I have a custom Url rewriter class that takes query strings such as /movies/godzilla.aspx and turns it into /template.aspx?id=1234
The rewriter works fine when I run it locally on the built in web server in Visual Studios, but when I put it on IIS 7.5 and try to access the page using the friendly name, I get a message saying the connection was reset and have to do an iisreset to get the site back online. The page is perfectly accessible from the server using the query string URL.
Here is a snippet of my web.config:
<system.web>
<httpModules>
<add name="ApFriendlyURL" type="FriendlyURL" />
</httpModules>
....
</system.web>
I'm confused as to why this works when running on the Dev Server in Visual Studios but not on IIS. I've played around with the settings in IIS, but I can't seem to find anything that would let me use the FriendlyURL class as the rewriter
HTTP modules in IIS 7.5 have to be configured in the system.webServer/modules section. Just copy your module definition there.
http://msdn.microsoft.com/en-us/library/aa347531(VS.90).aspx
Please be aware of the possible problem with the duplicate module configuration. If this is so, you turn off the integrated mode configuration:
http://www.iis.net/ConfigReference/system.webServer/validation
If you are working on .NET 2.0 application you should enable "Integrated mode" in your AppPool setings.
I have registered a custom asp.net route in a RouteTable.Routes.
routes.MapPageRoute(
"View Service",
"home/services/{*ServiceName}",
"~/home/displayservice.aspx"
);
My application uses ASP.NET 4.0 routing system, and everything works fine on a development machine, when I run the web site from Visual Studio to debug.
When I move the site to IIS7, the routing isn't happening when navigating to
http://new.komplus.ua/home/services/viruses/antivirus/
or any other path that supposed to be handled by the routing system. As a result, I get 404 error from the server.
I am sure I have copied the global.asax and the /home/displayservice.aspx to the web server, and have restarted the web site and app pool since update, but the routing still doesn't take place.
Other, non-routed pages, load fine.
Is there any particular configuration to IIS that has to be done in order for ASP.NET 4 routing to work, in comparison to VS2010 debug environment?
In order for ASP.NET 4.0 routing to work in IIS7 it is requried that the web.config has the webServer element decleared. For examle:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>
</system.webServer>
It is not a requirement in Visual Studio environment, where routing takes place even without this directive in web.config.
I am using HttpContext.RewritePath in Global.asax for some URL rewriting, and it works very well in my development environment on the Cassini server. But when I copy it to the production server running IIS 7, it isn't working. I have also tried to use Context.Server.TransferRequest but then I get the error: "This operation requires IIS integrated pipeline mode." on both Cassini and IIS 7 (on IIS 7 the website is running in "Integrated" mode in the AppPool).
I rewrite all URLs on the website like /[The main menuname]/[pagename].aspx e.g. from /web/thesite.aspx?mainmenu=manager to /manager/thesite.aspx OR /web/theOtherSite.aspx?mainmenu=about to /about/theOtherSite.aspx, and so on...
I found out that i need to add the following to web.config
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</system.webServer></configuration>