URL 映射适用于本地主机,但不适用于 asp.net 中的生产服务器 [英] URL Mapping works on localhost but not on production server in asp.net

查看:21
本文介绍了URL 映射适用于本地主机,但不适用于 asp.net 中的生产服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 web.config 文件中为 URL Mapping 设置了 mapped 的某些值.当我浏览文件时,它适用于 localhost.但是,当我将这个应用程序部署到 IIS 上时,它不会工作.显示错误:404:找不到资源."不知道为什么?

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?

有什么想法吗?

Web.config 标记:

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

在 .aspx 文件中:

<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..!

还有什么..我们需要在IISweb.config文件中做设置吗?

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

推荐答案

看到这个:http://forums.asp.net/t/1523272.aspx?urlmappings+stopped+when+moved+to+ii7

IIS 7 不支持 URL 映射 - 你应该使用 Url 重写模块

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

这篇关于URL 映射适用于本地主机,但不适用于 asp.net 中的生产服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆