I have an ASP.NET website that I'm hosing on Azure websites. Originally it used 4.0 as its targetFramework. I'm trying to change that to 4.5, but am getting 404 errors on my default document when I make the change.
My default document is "index.aspx" and I specify this in web.config as follows:
Works like a charm when the target framework is 4.0, but gives a 404 error when the target framework is switched to 4.5. Anyone have an idea what is wrong? All of the non-default documents work fine in both versions of the framework. (i.e. the extensionless
URLs are rewritten properly.)
lisota
0 Points
2 Posts
Default document not working on Azure website when framework is 4.5
Jan 02, 2013 01:43 AM|LINK
I have an ASP.NET website that I'm hosing on Azure websites. Originally it used 4.0 as its targetFramework. I'm trying to change that to 4.5, but am getting 404 errors on my default document when I make the change.
My default document is "index.aspx" and I specify this in web.config as follows:
<defaultDocument>
<files>
<add value="index.aspx" />
</files>
</defaultDocument>
I use URL rewrite to strip .aspx extensions and to not display the default document url. Here are the rewrite rules in order that they appear:
<rule name="index.aspx rewrite" stopProcessing="true">
<match url="(.*?)/?index\.aspx$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="{R:1}/" />
</rule>
<rule name="remove .aspx from URL" stopProcessing="true">
<match url="^(.*)\.aspx$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="{R:1}" redirectType="Permanent" />
</rule>
<rule name="add .aspx for non-existing files or directories">
<match url="(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}.aspx" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="{R:1}.aspx" />
</rule>
Works like a charm when the target framework is 4.0, but gives a 404 error when the target framework is switched to 4.5. Anyone have an idea what is wrong? All of the non-default documents work fine in both versions of the framework. (i.e. the extensionless URLs are rewritten properly.)