简体   繁体   English

如何使用IIS将ASP.NET应用程序部署到localhost?

[英]How to deploy an ASP.NET application to localhost using IIS?

I'm trying to deploy an ASP.NET application to localhost using IIS , I've been reading a LOT of tutorials and following them step by step but I just can't seem to make it work... 我正在尝试使用IISASP.NET应用程序部署到localhost,我一直在阅读很多教程,并逐步遵循它们,但是我似乎无法使其正常工作...

I created an Application Pool (TestPool) with .NET version 4.0 and gave it every permission to the folder where the application is at. 我使用.NET 4.0创建了一个应用程序池 (TestPool),并为它授予了应用程序所在文件夹的所有权限。

I then added an application to the Default Web Site and tried to run it at 然后,我将一个应用程序添加到“ 默认网站”,并尝试在以下位置运行它

http://localhost/TestApplication/ http:// localhost / TestApplication /

But I keep getting: 但我不断得到:

错误图片

Any idea what is wrong and how can I solve this? 知道有什么问题吗,我该如何解决?

Versions: 版本:

  • IIS version: 6.2 IIS版本:6.2
  • OS: Windows 8.1 作业系统:Windows 8.1
  • VS 2013 Ultimate: 12.0 VS 2013 Ultimate:12.0
  • VS .NET: 4.6 VS .NET:4.6

PS: It's my first attempt at deploying an ASP.NET application so if you need any further information just leave a comment. PS:这是我第一次尝试部署ASP.NET应用程序,因此,如果您需要任何其他信息,请发表评论。

EDIT: 编辑:

It is now running at least thanks to Julian and Marge, but when I run it using VS it has the default view, why isn't it showing when I run it through IIS? 现在至少要感谢Julian和Marge才能运行它,但是当我使用VS运行它时,它具有默认视图,为什么当我通过IIS运行它时却不显示它? When running through IIS it just lists the files: 通过IIS运行时,它仅列出文件:

文件清单

This error is because your website, in the IIS Server, does not have the Directory Browsing enabled and the default document (default page of the site ex: Default.aspx) configured. 该错误是因为您的网站在IIS服务器中未启用目录浏览功能,并且未配置默认文档(网站的默认页面,例如:Default.aspx)。

Go to IIS Server IIS > Default Documents and check if the default page of your site is listed, if no, add the page. 转到IIS服务器IIS>默认文档,然后检查是否列出了站点的默认页面,如果没有,请添加该页面。

Check the related link: https://support.microsoft.com/en-us/kb/942062 检查相关链接: https : //support.microsoft.com/en-us/kb/942062

Generally speaking, you do not need to access IIS manager at all to run your webpage on localhost. 一般来说,您根本不需要访问IIS管理器即可在本地主机上运行网页。 All what you need to do is right click on the project and then choose properties . 您所需要做的就是右键单击项目,然后选择属性 In the Web tab you will find Servers section. 在“ Web”选项卡中,您将找到“ 服务器”部分。 Make sure the Project Url is something like http://localhost/myproj or simply http://localhost/ then hit Create Virtual Directory . 确保Project Url是类似于http:// localhost / myproj或只是http:// localhost /的名称,然后单击Create Virtual Directory Your webpage should be up by then, and you can access it either in debug mode, or simply by navigating your browser to the Project Url you have chosen. 届时,您的网页应已启动,您可以在调试模式下访问它,也可以简单地通过将浏览器导航到所选的项目URL来访问它。

When you add web application in IIS ex. 在IIS ex中添加Web应用程序时。

在此处输入图片说明

That your hostname should be to add in host file which is C:\\Windows\\System32\\drivers\\etc"\\hosts 您的主机名应该添加到主机文件C:\\ Windows \\ System32 \\ drivers \\ etc“ \\ hosts中

ex. 例如

127.0.0.1 test.pln 127.0.0.1 test.pln

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM