如何从开发Web服务器的根URL删除虚拟路径? [英] How to remove virtual path from root url of dev web server?

查看:58
本文介绍了如何从开发Web服务器的根URL删除虚拟路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS.NET 2005 beta 2.当我使用

默认的ASP.NET开发Web服务器在本地运行我的项目时,它使用根地址运行,例如


http:// localhost:11243 / testsite /


但是,当我部署到运行真正IIS的远程测试服务器时,我的应用程序的真正

根变为:
http:// localhost /

我想要做的就是让我这样做本地机器asp.net dev

服务器不使用虚拟根,而是使用:
http:// localhost:11243 /

原因是我的网址可以正常工作。


例如,我必须在样式表中指定背景图像网址,并且像/ images / whatever.gif正在翻译不同的
a路径ntly取决于

我是在开发中本地运行还是在生产中远程运行。


谢谢,


史蒂夫

I am using VS.NET 2005 beta 2. When I run my project locally using the
default ASP.NET Development Web Server it runs using a root address like
this:
http://localhost:11243/testsite/

However when I deploy to a remote test server running real IIS, the real
root of my application becomes:
http://localhost/

What I want to do is have it so that on my local machine the asp.net dev
server does not use the virtual root, and instead uses:
http://localhost:11243/

The reason for this is so that my URLs will work.

For example I have to specify a background image url in my style sheets, and
a path like /images/whatever.gif is translating differently depending on
whether I run this locally in dev or remotely in production.

Thanks,

Steve

推荐答案

从两天前开始快速搜索这个帖子:

http://groups.google.com/group /micro...4f1e5e32ad0894


以下是该主题中提到的文章,它解决了您对

的关注:
http://www.codeproject.com/aspnet/Multisite.asp

Jason Kester

外籍软件咨询服务
http://www.expatsoftware.com/

A quick search would have netted you this thread from two days ago:

http://groups.google.com/group/micro...4f1e5e32ad0894

Here is the article refered in that thread, which addresses your
concern:
http://www.codeproject.com/aspnet/Multisite.asp
Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/


我可以看到如何写作ab asic httpmodule删除部分路径

是一个简单的解决方案。


然而不利的一面是,这个模块必须在
生产并增加很多开销。每个请求都必须经过检查才能查看是否匹配/ devsiteroot / images /因此它可以将请求重写为/ images /并重写

。而且我不能让过滤器运行在

只是开发机器并在生产时禁用它因为我使用Copy Web和

其他此类文件来保持生产和开发站点同步。


你们是如何处理这个问题的?这是相当混乱的IMO。我还有一个与b $ b相关的问题,因为一些html属性如BACKGROUND无法完成

服务器端所以你甚至不能使用〜/ what。例如你不能做

a HTML表背景与runat = server ...


史蒂夫


" jasonkester" < JA ********* @ gmail.com>在消息中写道

news:11 ********************** @ z14g2000cwz.googlegr oups.com ...
I can see how writting a basic httpmodule to remove part of the path would
be a prety easy solution.

However the downside is that this module would then have to run in
production and add a lot of overhead. Every request would have to be
checked to see if it matches say "/devsiteroot/images/" so it could rewrite
the request as just "/images/". And I can''t have the filter running on say
just the dev machine and disable it on production because I use Copy Web and
other such files to keep the production and dev sites in sync.

How are you guys handling this. It is quite messy IMO. I also have a
related issue in that some html attributes such as BACKGROUND cannot be done
server side so you cannot even use "~/whatever". For example you cannot do
a HTML table BACKGROUND with runat=server...

Steve

"jasonkester" <ja*********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
快速搜索会让你在两天前获得这个帖子:

http://groups.google.com/group/micro...4f1e5e32ad0894
以下是该主题中提到的文章,它解决了您的问题:
http://www.codeproject.com/aspnet/Multisite.asp

Jason Kester
外籍软件咨询服务
http://www.expatsoftware.com/
A quick search would have netted you this thread from two days ago:

http://groups.google.com/group/micro...4f1e5e32ad0894

Here is the article refered in that thread, which addresses your
concern:
http://www.codeproject.com/aspnet/Multisite.asp
Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/



使用〜/ images / whatever.gif


代字号(〜)表示应用程序在ASP.NET中的根。 br />

所有URL都是相对于根目录的,

无论它们位于何处。


Juan T. Llibre

ASP.NET MVP

ASP.NET常见问题解答: http://asp.net.do/faq/

=================== =======


" Steve Franks" < PL **** @ postreplyhere.com>在留言中写道

新闻:xq ************************************ ***** @ c omcast.com ...
Use ~/images/whatever.gif

The tilde ( ~ ) signifies the application''s root in ASP.NET.

All URLs will be relative to the root directory,
no matter where they are physically located.

Juan T. Llibre
ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
==========================

"Steve Franks" <pl****@postreplyhere.com> wrote in message
news:xq*****************************************@c omcast.com...
我正在使用VS.NET 2005 beta 2.当我使用默认的ASP.NET在本地运行我的项目时开发Web服务器它使用如下的根地址运行:
http:// localhost:11243 / testsite /

然而,当我部署到运行真正IIS的远程测试服务器时,我的应用程序的真正根目录变为:
http:// localhost /

我想要做的就是在我的本地机器上使用asp.net dev服务器不使用虚拟根,而是使用:
http:// localhost:11243 /

这样做的原因是我的网址可以正常工作。

例如我必须在我的样式表中指定一个背景图片网址,和/
/ images / whatever.gif这样的路径会有不同的翻译,具体取决于我是在本地运行本地
还是在生产中远程运行。

谢谢,
<史蒂夫
I am using VS.NET 2005 beta 2. When I run my project locally using the default ASP.NET
Development Web Server it runs using a root address like this:
http://localhost:11243/testsite/

However when I deploy to a remote test server running real IIS, the real root of my
application becomes:
http://localhost/

What I want to do is have it so that on my local machine the asp.net dev server does not
use the virtual root, and instead uses:
http://localhost:11243/

The reason for this is so that my URLs will work.

For example I have to specify a background image url in my style sheets, and a path like
/images/whatever.gif is translating differently depending on whether I run this locally
in dev or remotely in production.

Thanks,

Steve



这篇关于如何从开发Web服务器的根URL删除虚拟路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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