使用默认服务器时,为什么 Visual Studio 将解决方案路径附加到根 url?
当我在 Visual Studio 2010 中使用默认服务器(不确定这是 cassini 还是 IIS?)时,我打开网站项目(不是解决方案)的路径中的最后一个文件夹将附加到losthost url。
例如:
C:\myproject\mywebsite1\
将打开以下网址:
http://localhost:x /mywebsite1/login.aspx。
这似乎会导致 CSS 文件和 javascript 无法解析等问题,但如果我将 url 更改为 http://localhost: x/login.aspx 然后我收到一条错误,指出 aspx 文件不存在。
为什么要附加一个额外的文件夹?这非常烦人,我只希望所提供的文件位于根 URL 路径中,就像它们位于网站项目中一样。
When I use the default server in Visual Studio 2010 (Not sure if this is cassini or IIS?), the the last folder within the path at which I open the web site project (not a solution), is appended to the losthost url.
For example:
C:\myproject\mywebsite1\
Would open a url at the following:
http://localhost:x/mywebsite1/login.aspx.
This seems to cause problems with CSS files and javascript not resolving etc, but if I change the url to http://localhost:x/login.aspx I then get an error stating the aspx file is not present.
Why is an extra folder appended? This is highly annoying, I just want the files being served to be in the root URL path as they are in the website project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
转到您的项目,右键单击属性,然后在 Web 选项卡下,您应该选中“使用 Visual Studio 开发服务器”,您可以在其中指定端口和虚拟路径,可能有
/mywebsite1
,只需删除该虚拟路径即可。您不久前问过这个问题,但希望它能有所帮助。
Go to your project, right click, properties and under the web tab, you should have checked Use Visual Studio Development Server, there you can specify a port and a virtual path, probably you have
/mywebsite1
there, just delete that virtual path.You asked this some time ago, but hope it helps anyway.