简体   繁体   English

ASP.NET-将网站发布到IIS

[英]ASP.NET - Publishing a web site to IIS

What is the difference between publishing a website to {localdrive}\\inetpub\\wwwroot and anywhere else on the web server eg C:\\Website. 将网站发布到{localdrive} \\ inetpub \\ wwwroot和Web服务器上其他任何位置(例如C:\\ Website)之间有什么区别?

I have noticed that I am always left with a directory and a website in the IIS console if I publish to {localdrive}\\inetpub\\wwwroot. 我已经注意到,如果我发布到{localdrive} \\ inetpub \\ wwwroot,则在IIS控制台中总是留下目录和网站。

After reading articles on MSDN, I am still unclear of the difference. 在阅读了有关MSDN的文章之后,我仍然不清楚它们之间的区别。 I realise that there is probably a simpe answer to this, but I cannot find it. 我意识到可能对此有一个简单的答案,但是我找不到它。

Nothing too much as your website path in IIS can point to any directory. IIS中的网站路径不能指向任何目录,这没什么大不了的。 However, that being said always double check your directory permissions and security settings. 但是,总要仔细检查您的目录权限和安全设置。 In addition, I guess if a hacker did compromised your webserver... the default c:\\inetpub\\wwwroot is well known. 另外,我猜想黑客是否确实侵害了您的Web服务器...默认的c:\\ inetpub \\ wwwroot是众所周知的。

And just for good measure in case you are having issues - check out the Aspnet_regiis.exe tool on MSDN as it usually solves a lot of issues for folks. 而且如果有问题的话,这是一个很好的选择-请检查MSDN上的Aspnet_regiis.exe工具,因为它通常为人们解决了很多问题。

The web path / is already mapped to c:\\inetpub\\wwwroot , so /abc is mapped to c:\\inetpub\\wwwroot\\abc automatically. Web路径/已经映射到c:\\inetpub\\wwwroot ,因此/abc已自动映射到c:\\inetpub\\wwwroot\\abc

When you publish to c:\\website , you need to set up a virtual path manually. 当发布到c:\\website ,您需要手动设置虚拟路径。

{localdrive}\\inetpub\\wwwroot is usually used for the default web site that comes with IIS. {localdrive} \\ inetpub \\ wwwroot通常用于IIS附带的默认网站。 Additional Microsoft products use the same directory and take advantage of the virtual directories that exist in the default site. 其他Microsoft产品使用相同的目录,并利用默认站点中存在的虚拟目录。

If this is your personal web site, or a web site you created from scratch, you can publish anywhere you want. 如果这是您的个人网站,还是您从头开始创建的网站,则可以在任何位置发布。

Before you publish, you need to make sure IIS knows where the directory will be, and you need to assign the correct permissions for that folder. 在发布之前,需要确保IIS知道目录将在哪里,并且需要为该文件夹分配正确的权限。

Although they say Virtual Directory created by default for your website in wwwroot and you don't have to configure it again. 尽管他们说默认情况下在wwwroot中为您的网站创建了虚拟目录,但您不必再次配置它。 Many times I found we still have to go there and click on Remove and then click on Create button again :) 很多次我发现我们仍然必须去那里,单击“删除”,然后再次单击“创建”按钮:)

Thus it is almost no problem if you create your website outside wwwroot, only difference outside you have to give full path of VD and inside you have to click Remove and then Create button 因此,如果您在wwwroot之外创建网站几乎没有问题,只需在外部提供完整的VD路径,在内部则必须单击“删除”,然后单击“创建”按钮

The default website in IIS is mapped to C:\\inetpub\\wwwroot by default, so publishing to wwwroot makes it easy to add applications as virtual directories. IIS中的默认网站默认情况下映射到C:\\inetpub\\wwwroot ,因此发布到wwwroot可以轻松地将应用程序添加为虚拟目录。

However, you can publish wherever you like, and either point a virtual directory or new website at your publication location. 但是,您可以在任意位置发布,也可以在您的发布位置指向虚拟目录或新网站。 You simply need to make sure user the App Pool is running as (usually IUSR under IIS7, IUSR_MachineName under previous versions) has read/execute permissions on the folder you are publishing to. 您只需要确保用户的应用程序池运行时(通常是IIS7下的IUSRIUSR_MachineName版本下的IUSR_MachineName )对您要发布到的文件夹具有读/执行权限。

The problem I had was different from all of the above. 我遇到的问题与上述所有问题都不相同。 I was trying to publish in "C:\\inetpub\\wwwroot" and the publish failed every time. 我试图在“ C:\\ inetpub \\ wwwroot”中发布,但每次发布都会失败。 Than i changed the publish folder to another and it worked. 比起将发布文件夹更改为另一个文件夹,它起作用了。 When I launched visual studio as administrator I could copy to C:\\inetpub\\wwwroot also without problems 当我以管理员身份启动Visual Studio时,也可以毫无问题地复制到C:\\ inetpub \\ wwwroot

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

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