URL Mapping works on localhost but not on producti

2019-02-25 13:03发布

问题:

I have certain values that are mapped in web.config file for URL Mapping. When i browse for file it works on localhost. But, when i deploy this application on IIS on Production it wont work. shows Error: "404: The resource cannot be found." dont know why?

Any idea?

Web.config markup:

<urlMappings enabled="true">
      <add url="~/Pune" mappedUrl="~/City.aspx?ID=1"/>
</urlMappings>

In .aspx file:

<a href="Pune">Pune City</a>

After searching i have got some clue that it must be:

<urlMappings enabled="true">
          <add url="~/Pune" mappedUrl="http://mycustomdomain.com/City.aspx?ID=1"/>
</urlMappings>

But, unfortunately this too wont work..!

Anything else..do we need to do settings in IIS or web.config file?

回答1:

To do this just follow steps:

For IIS 7: open IIS manager , double click on the website , double click Handler Mappings , right click on the specific handler , click Request Restrictions and uncheck the checkbox Invoke handler only if request is mapped to.



回答2:

See this: http://forums.asp.net/t/1523272.aspx?urlmappings+stopped+when+moved+to+ii7

Url mappings should not be supported in IIS 7 - you should use Url Rewrite module