visual-studio ASPX 页面不显示在 Internet Explorer 上

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1560779/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 11:05:23  来源:igfitidea点击:

ASPX page does not show on Internet Explorer

asp.netvisual-studiointernet-explorer

提问by Oded

I've created a new Web Site on VS2005. An ASPX file was created.

我在 VS2005 上创建了一个新网站。已创建 ASPX 文件。

when I run the file in VS, it opens via IE and an ASP.NET Development Server icon appears near the clock.

当我在 VS 中运行该文件时,它会通过 IE 打开,并且时钟附近会出现一个 ASP.NET 开发服务器图标。

when I try to run the aspx file in IE, I get the error:

当我尝试在 IE 中运行 aspx 文件时,出现错误:

The XML page cannot be displayed

Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. 

A name was started with an invalid character. Error processing resource 'file:///C:/Documents and Settings/odedk/My Documen...

<%@ Page Language="VB" AutoEventWireup="false"%>
-^

What can be the problem?

可能是什么问题?

回答by mauris

It seems like you opened the .aspx file on your hard disk with IE.

好像你用 IE 打开了硬盘上的 .aspx 文件。

You need to open the page via the local server (localhost).

您需要通过本地服务器(localhost)打开页面。

To do this, simply enter http://localhost:PortNo/in your address bar where PortNo is the port number given by the ASP.NET Development Server.

为此,只需http://localhost:PortNo/在地址栏中输入PortNo 是 ASP.NET 开发服务器提供的端口号。

回答by David

An Aspx page needs to be processed by the web server - either IIS or the web server built into Visual Studio. You can't just browse to it in the file system, double-click on it and have it work.

Aspx 页面需要由 Web 服务器处理 - IIS 或内置于 Visual Studio 的 Web 服务器。你不能只是在文件系统中浏览到它,双击它并让它工作。

Instead, in Visual Studio, use right click on the aspx and choose "Set as start page".

相反,在 Visual Studio 中,右键单击 aspx 并选择“设置为起始页”。

Then start the debugger by hitting F5 or the Start Debugging" button.

然后按 F5 或“开始调试”按钮启动调试器。

Edit - addedit sounds like you need to know the basics of web development and server-side technology in general, and Asp.Net specifically a bit better.

编辑 - 添加听起来您需要了解一般的 Web 开发和服务器端技术的基础知识,尤其是 Asp.Net。

Here's a verygood place to start for beginners.

对于初学者来说,这是一个非常好的起点。

http://msdn.microsoft.com/en-us/beginner/bb308772.aspx

http://msdn.microsoft.com/en-us/beginner/bb308772.aspx

回答by Brian Schantz

You may need to run aspnet_regiis.exe from \windows\Microsoft.net\framework\.

您可能需要从 \windows\Microsoft.net\framework\ 运行 aspnet_regiis.exe。

http://msdn.microsoft.com/en-us/library/k6h9cz8h(VS.80).aspx

http://msdn.microsoft.com/en-us/library/k6h9cz8h(VS.80).aspx

回答by Kobi

You cannot open an aspx file directly in the browser.
It has to be on the IIS, where the server parses it, run it, and generates meaningful HTML.

不能直接在浏览器中打开 aspx 文件。
它必须在 IIS 上,服务器在那里解析它、运行它并生成有意义的 HTML。

The easiest way to do that is (on IIS 6):

最简单的方法是(在 IIS 6 上):

  1. Open the IIS. (Control Panel > Administrative Tool).
  2. Go to Web Sites > Default Web Site.
  3. Right Click on Default Web Site, select New > Virtual Directory.
  4. Give it a name (Test) and the path to your files (the root, where you have your web.config).
  5. Check the Run Scriptsbox.
  1. 打开 IIS。( Control Panel > Administrative Tool).
  2. Web Sites > Default Web Site
  3. 右键单击Default Web Site,选择New > Virtual Directory
  4. 给它一个名称 ( Test) 和文件的路径(根,你有你的web.config)。
  5. 选中该Run Scripts框。

That's it. Now you can right click on the aspx file on the right, and browse it.
(If it still doesn't work, common problems are ASP.Net not defines, and sometimes windows authentication)

而已。现在您可以右键单击右侧的 aspx 文件,然后浏览它。
(如果还是不行,常见的问题是ASP.Net没有定义,有时是windows身份验证)

Here's a post with much more details: http://www.iisworkstation.com/2008/06/how-to-create-website-using-iis-6-level.html

这是一个包含更多详细信息的帖子:http: //www.iisworkstation.com/2008/06/how-to-create-website-using-iis-6-level.html