在Localhost上找不到页面和图像 [英] Page and Images not found on Localhost

查看:87
本文介绍了在Localhost上找不到页面和图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


也许这是ASP.NET 2.0课程101中的一个简单问题,但我必须

错过了它。当我在Visual Web Developer中创建页面并使用URL

时,如/images/picture.gif或类似的链接< a

href =" ../../ Search / page.aspx">,

只要我发布,一切正常该网站是一个根网站,如
http:// localhost

但是,我正在c:\development\project中的本地C盘上进行开发。我已经从IIS中的该文件夹创建了一个虚拟网站。要访问它,我在 http:// localhost / project 中键入




这就是问题所在。当我尝试使用
http:// localhost / project 在IE7中运行网站时或者在VS2005中调试网站,或者在b $ b中默认网站。或选定的网站 http:// localhost / project ,我遗失了所有

我的图像,样式表甚至最终都有破碎的链接。但是在一个Root

网站上,一切都很好。


例如我找不到404文件 http://localhost/search/page.aspx ,当

资源实际上是 http://localhost/project/search/page.aspx

我尝试过使用〜/ images / picture.gif并且这也不起作用......

与URL路径相同。


有人说我必须创建一个虚拟域

c:\development\project文件夹,但我不知道他的意思。此外,它还需要永久地将网站发布到根服务器。如果我可以在

制作并编译更改之后立即在开发文件夹中进行调试,那就太快了。


感谢所有人....

Hi all,

Maybe this is a simple problem found in ASP.NET 2.0 course 101, but I must
have missed it. When I create a page in Visual Web Developer and use URLs
like "/images/picture.gif " or a link like <a
href="../../Search/page.aspx">,
everything works fine as long as I publish the site to a root web like
http://localhost.

However, I am developing on my local C drive in c:\development\project. I
have created a virtual web site from that folder in IIS. To access it I type
in http://localhost/project.

Here''s the problem. When I try to either run the website in IE7 using
http://localhost/project or debug the website from within VS2005, either on
the "default site" or the selected site http://localhost/project, I lose all
my images, stylesheets and even end up with broken links. But on a Root
website evrything is fine.

For example I get 404 File not found http://localhost/search/page.aspx, when
the resource is actually at http://localhost/project/search/page.aspx.

I have tried using "~/images/picture.gif" and that doesn''t work either...
same with the URL paths.

Somebody said I had to create a virtual Domain out of the
c:\development\project folder, but I don''t know what he meant. Also, it
takes forever to "publish'' the website to the root server. It would be so
much faster if I could just debug in the development folder right after
making and compiling a change.

Thanks to all....

推荐答案

请记住,虚拟目录不会成为网站的根目录。你需要确保你的目录被标记为一个应用程序。为此,

进入IIS的管理控制台(MMC)。找到目录,

右键单击它并选择属性。确保在Home

目录下,在应用程序设置区域中创建了一个应用程序。

如果没有,请单击创建应用程序按钮。

ASP.Net并不关心目录是什么,但是如果它没有被标记为

应用程序,它会查看根应用程序或其上方的应用程序

用于URL引用以及bin目录。

-


希望这有帮助,

Mark Fitzpatrick

前Microsoft FrontPage MVP 199?-2006

" John Kotuby" < jo *** @ powerlist.comwrote in message

news:%2 **************** @ TK2MSFTNGP05.phx.gbl ...
Keep in mind, a virtual directory doesn''t make it the root of a site. You
have to ensure that your directory is marked as an application. To do this
go into the management control console (MMC) for IIS. Find the directory,
right-click on it and select properties. Make sure that under the Home
Directory there is an application created in the Application Settings area.
If not, click the create application button.

ASP.Net doesn''t care what the directory is, but if it''s not marked as an
application it looks to the root application or the one immediately above it
for URL references as well as the bin directory.
--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"John Kotuby" <jo***@powerlist.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...

大家好,


也许这是ASP.NET 2.0课程101中的一个简单问题,但我必须

错过了它。当我在Visual Web Developer中创建页面并使用URL

时,如/images/picture.gif或类似的链接< a

href =" ../../ Search / page.aspx">,

只要我发布,一切正常该网站是一个根网站,如
http:// localhost

但是,我正在c:\development\project中的本地C盘上进行开发。我已经从IIS中的该文件夹创建了一个虚拟网站。要访问它,我需要在 http:// localhost / project 中键入



这就是问题所在。当我尝试使用
http:// localhost / project 在IE7中运行网站时或者在VS2005中调试网站,或者在默认网站上使用
。或选定的网站 http:// localhost / project ,我

输了我所有的图像,样式表,甚至最终都有破碎的链接。但是在

a根网站evrything很好。


例如我得到404文件未找到 http://localhost/search/page.aspx ,当资源实际位于
时,
http://localhost/project/search/page.aspx


我尝试过使用〜/ images / picture.gif并且这也不起作用......

与URL路径相同。


有人说我必须创建一个虚拟域

c:\development\project文件夹,但我不知道他的意思。此外,它还需要永久地将网站发布到根服务器。如果我可以在

制作并编译更改之后立即在开发文件夹中进行调试,那就太快了。


感谢所有人....
Hi all,

Maybe this is a simple problem found in ASP.NET 2.0 course 101, but I must
have missed it. When I create a page in Visual Web Developer and use URLs
like "/images/picture.gif " or a link like <a
href="../../Search/page.aspx">,
everything works fine as long as I publish the site to a root web like
http://localhost.

However, I am developing on my local C drive in c:\development\project. I
have created a virtual web site from that folder in IIS. To access it I
type in http://localhost/project.

Here''s the problem. When I try to either run the website in IE7 using
http://localhost/project or debug the website from within VS2005, either
on the "default site" or the selected site http://localhost/project, I
lose all my images, stylesheets and even end up with broken links. But on
a Root website evrything is fine.

For example I get 404 File not found http://localhost/search/page.aspx,
when the resource is actually at
http://localhost/project/search/page.aspx.

I have tried using "~/images/picture.gif" and that doesn''t work either...
same with the URL paths.

Somebody said I had to create a virtual Domain out of the
c:\development\project folder, but I don''t know what he meant. Also, it
takes forever to "publish'' the website to the root server. It would be so
much faster if I could just debug in the development folder right after
making and compiling a change.

Thanks to all....



re:

" ; /images/picture.gif"

我尝试过使用〜/ images / picture.gif这也不起作用...
"/images/picture.gif"
I have tried using "~/images/picture.gif" and that doesn''t work either...



"〜/ images / picture.gif"确实有效...


无论你是在根应用程序还是在子目录中,它都将解析到正确的目录,

如果目录存在当然,在应用程序中。


您不能将根目录的图像目录用于虚拟应用程序。


每个应用程序都应该有它自己的图像目录,并使用〜/ images / picture.gif

将解析应用程序图像目录的正确路径。


同样适用于其他应用程序目录。


Juan T. Llibre,asp.net MVP

asp.net faq: http://asp.net.do/faq/

foros de asp.net,en espa?ol: http://asp.net .do / foros /

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

" John Kotuby" < jo *** @ powerlist.com在消息新闻中写道:%2 **************** @ TK2MSFTNGP05.phx.gbl ...

"~/images/picture.gif" does work...

That will resolve to the right directory whether you''re in the root app or in a subdirectory,
provided the directory exists within the application, of course.

You cannot use the root directory''s images directory for virtual apps.

Each app should have its own images directory, and using "~/images/picture.gif"
will resolve the correct path to the application''s images directory.

The same is valid for other application directories as well.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espa?ol : http://asp.net.do/foros/
===================================
"John Kotuby" <jo***@powerlist.comwrote in message news:%2****************@TK2MSFTNGP05.phx.gbl...


大家好,


也许这是ASP.NET 2.0课程101中的一个简单问题,但我一定错过了它。当我在Visual Web Developer中创建一个页面时,使用像/images/picture.gif这样的URL。或类似的链接< a

href =" ../../ Search / page.aspx">,

只要我发布,一切正常站点到根网站,如 http:// localhost


但是,我正在c:\development\project中的本地C盘上进行开发。我已经从IIS中的该文件夹创建了一个虚拟的

网站。要访问它,我输入 http:// localhost / project


这就是问题所在。当我尝试使用 http:// localhost / project

在VS2005内调试网站,或者在默认网站上进行调试。或选定的网站
http:// localhost / project ,我丢失了所有图片,样式表,甚至最终断开链接。但是Root网站上的
一切都很好。


例如我找不到404文件 http://localhost/search/page.aspx ,当资源是 http://localhost/project/search/page.aspx 。
Hi all,

Maybe this is a simple problem found in ASP.NET 2.0 course 101, but I must have missed it. When I
create a page in Visual Web Developer and use URLs like "/images/picture.gif " or a link like <a
href="../../Search/page.aspx">,
everything works fine as long as I publish the site to a root web like http://localhost.

However, I am developing on my local C drive in c:\development\project. I have created a virtual
web site from that folder in IIS. To access it I type in http://localhost/project.

Here''s the problem. When I try to either run the website in IE7 using http://localhost/project or
debug the website from within VS2005, either on the "default site" or the selected site
http://localhost/project, I lose all my images, stylesheets and even end up with broken links. But
on a Root website evrything is fine.

For example I get 404 File not found http://localhost/search/page.aspx, when the resource is
actually at http://localhost/project/search/page.aspx.


我尝试过使用〜/ images / picture.gif这也不起作用......与URL路径相同。


有人说我必须从c:\development\project文件夹中创建一个虚拟域,但我

不知道他的意思。此外,将网站发布到根服务器需要花费很长时间。如果我可以在制作后立即在开发文件夹中调试并且

编译更改,那么
将会快得多。


感谢所有人....
I have tried using "~/images/picture.gif" and that doesn''t work either... same with the URL paths.

Somebody said I had to create a virtual Domain out of the c:\development\project folder, but I
don''t know what he meant. Also, it takes forever to "publish'' the website to the root server. It
would be so much faster if I could just debug in the development folder right after making and
compiling a change.

Thanks to all....



Mark,


再次感谢...


我在IIS管理器中为c:\Development\Project

虚拟Web文件夹创建了一个应用程序,应用程序名称又以Project形式返回;


我还需要参考 http:// localhost / project 出现默认的

页面。仍然链接被破坏了。


我现在应该能够在不使用localhost的情况下访问该网站吗?在

URL中,或创建应用程序时,将网站的根设置为

" Project"文件夹?


似乎VS2005仍然将// localhost视为Root文件夹。

让我疯狂......但我可以继续工作通过将该站点发布到办公室中另一台IIS服务器的

根目录。


.... John


Mark Fitzpatrick < ma ****** @ fitzme.com在留言中写道

news:ur ************** @ TK2MSFTNGP04.phx.gbl ...
Mark,

Thanks again...

I created an application in IIS manager for the c:\Development\Project
virtual web folder and the application name came back as "Project".

I still need to reference http://localhost/project to get to the default
page, it appears. And still the links are broken.

Should I be able to access the site now without using "localhost" in the
URL, or does creating an application set the Root of the site as the
"Project" folder?

It seems that VS2005 is still looking at //localhost as the Root folder.
Driving me nuts... but I can continue to work by publishing the site to the
root of another IIS server in the office.

.... John

"Mark Fitzpatrick" <ma******@fitzme.comwrote in message
news:ur**************@TK2MSFTNGP04.phx.gbl...

请记住,虚拟目录不会成为网站的根目录。你需要确保你的目录被标记为一个应用程序。为此,

进入IIS的管理控制台(MMC)。找到目录,

右键单击它并选择属性。确保在Home

目录下,在应用程序设置

区域中创建了一个应用程序。如果没有,请单击创建应用程序按钮。


ASP.Net并不关心目录是什么,但如果它没有标记为

应用程序它看起来是根应用程序或上面的那个

它用于URL引用以及bin目录。


-


希望这有帮助,

Mark Fitzpatrick

前微软FrontPage MVP 199?-2006


John Kotuby < jo *** @ powerlist.comwrote in message

news:%2 **************** @ TK2MSFTNGP05.phx.gbl ...
Keep in mind, a virtual directory doesn''t make it the root of a site. You
have to ensure that your directory is marked as an application. To do this
go into the management control console (MMC) for IIS. Find the directory,
right-click on it and select properties. Make sure that under the Home
Directory there is an application created in the Application Settings
area. If not, click the create application button.

ASP.Net doesn''t care what the directory is, but if it''s not marked as an
application it looks to the root application or the one immediately above
it for URL references as well as the bin directory.
--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"John Kotuby" <jo***@powerlist.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...

>大家好,

也许这是ASP.NET 2.0课程101中的一个简单问题,但我必须错过了。当我在Visual Web Developer中创建页面并使用诸如/images/picture.gif之类的URL时或者像< a
href =" ../../ Search / page.aspx">这样的链接,
只要我将网站发布到像
http:// localhost

然而,我正在开发我的c:\development\project中的本地C盘。我已经从IIS中的该文件夹创建了一个虚拟网站。要访问它,我需要输入 http:// localhost / project

这就是问题所在。当我尝试使用
http:// localhost / project 在IE7中运行网站时或者在VS2005中调试网站,或者在默认网站上进行调整。或选定的网站 http:// localhost / project ,我将丢失所有图片,样式表,甚至最终断开链接。但是在一个Root网站上,一切都很好。

例如我找不到404文件 http://localhost/search/page.aspx ,当资源实际位于
时 http://localhost/project/search/page.aspx 。

我试过用〜 /images/picture.gif"并且这也不起作用......
与URL路径相同。

有人说我必须从
c:\development中创建一个虚拟域\ project文件夹,但我不知道他的意思。此外,它还需要永久地将网站发布到根服务器。如果我可以在制作和编译更改后立即在开发文件夹中进行调试,那将会更快。

感谢所有人....
>Hi all,

Maybe this is a simple problem found in ASP.NET 2.0 course 101, but I
must have missed it. When I create a page in Visual Web Developer and use
URLs like "/images/picture.gif " or a link like <a
href="../../Search/page.aspx">,
everything works fine as long as I publish the site to a root web like
http://localhost.

However, I am developing on my local C drive in c:\development\project. I
have created a virtual web site from that folder in IIS. To access it I
type in http://localhost/project.

Here''s the problem. When I try to either run the website in IE7 using
http://localhost/project or debug the website from within VS2005, either
on the "default site" or the selected site http://localhost/project, I
lose all my images, stylesheets and even end up with broken links. But on
a Root website evrything is fine.

For example I get 404 File not found http://localhost/search/page.aspx,
when the resource is actually at
http://localhost/project/search/page.aspx.

I have tried using "~/images/picture.gif" and that doesn''t work either...
same with the URL paths.

Somebody said I had to create a virtual Domain out of the
c:\development\project folder, but I don''t know what he meant. Also, it
takes forever to "publish'' the website to the root server. It would be so
much faster if I could just debug in the development folder right after
making and compiling a change.

Thanks to all....




这篇关于在Localhost上找不到页面和图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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