在哪里放置新的 ASP.NET 网站?
生产 ASP.NET 应用程序的最佳位置在哪里?我的意思是我们需要对文件夹进行较少权限操作的地方,并且可能是专家选择的地方。
在 C:\inetpub\wwwroot
或 C:\inetpub
或其他地方?
在开发/测试阶段,我通常将其放在 C:\inetpub\wwwroot
下,并创建一个新的 Web 应用程序而不设置绑定。但在带有绑定的生产版本上,我不确定哪里是正确的位置。
Where's the best place for a production asp.net application? I mean a place that we need less permission manipulation on folders and probably the experts choice.
under C:\inetpub\wwwroot
or C:\inetpub
or elswhere ?
In development/test phases I usually put it under C:\inetpub\wwwroot
and create a new web application without setting bindings. But on production version with binding I'm not sure where's the right place.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以将其放在您喜欢的任何地方,关键是确保其运行的应用程序池设置为以低特权用户身份运行(如 NT AUTHORITY\NETWORK SERVICE),然后确保用户具有读取< /em>(如果需要的话,可能还有浏览)对放置 Web 应用程序的文件夹的权限。用户很少(如果有的话)需要写入或< em>修改文件夹的权限。
设置权限应该不是问题,您应该为要运行应用程序池的用户设置与我上面提到的相同的基本权限。为此,您可以使用 PowerShell 或 WMI,并且无论安装到哪个文件夹,都应该使用相同的权限。
您始终可以将所有这些打包到安装程序中,然后只需在安装程序向导中点击下一步..下一步...完成...即可在上设置您的网站任何机器。在安装程序中执行此操作还可以让您确定没有遗漏任何内容。
You can put it anywhere you like, they key thing is to ensure that the app pool it is running under is set to run as a low privileged user (like NT AUTHORITY\NETWORK SERVICE), then ensure that user has Read (and possibly Browse if you want it) permissions on the folder you put your web app in. Very seldom (if ever) will the user need Write or Modify permissions on the folder.
Setting permissions should not be a problem, you should set the same basic permissions i mentioned above for the user you want to run the app pool as. You can use PowerShell or WMI for this, and you should use the same permissions no matter what folder you install in to.
You could always wrap all this up into an installer, then it can be as simple as hitting Next.. Next... Finish... in an installer wizard to set up your website on any machine. Doing this in an installer also gives you some certainty that nothing has been missed.
就我个人而言,我的 D: 驱动器上有一个“Development”文件夹,然后根据工作将其细分为不同的类别。我通常不使用 inetpub 目录,并且遇到的任何权限问题我只是直接设置到我自己的开发结构中的相关文件夹中。
在我过去使用过的生产环境中,我们通常会做同样的事情。主要是为了真正帮助备份方案,但也因为没有严格需要使用默认 IIS 目录 - 您可以自由地按照您喜欢的方式构建内容。
Personally I have a 'Development' folder on my D: drive which is then subdivided into different categories depending on the work. I generally don't use inetpub directory and any permission issues I come across I just set directly onto the relevant folder within my own development structure.
On production environments I've used in the past, we've generally done the same thing. Mainly to help backup scenarios really, but also because there's no strict need to use the default IIS directories - you're free to structure things how you like.
就个人而言,我总是创建一个名为
WebSites
的新文件夹(在驱动器的根目录中)。然后,我确保它具有网站进程(又名应用程序池
)的适当权限。例如。
它还使管理变得更容易,因为您不必在文件夹结构中寻找任何/所有网站。
但从技术上讲,它可以(或多或少)在任何地方 - 只需要设置正确的权限即可。
额外的答案
我还从 IIS 中删除了默认网站..这实际上意味着我也可以删除
c:\inetpub\wwwroot
。Personally, I always create a new folder (in the root of a drive) called
WebSites
. I then make sure it has the appropriate permissions for the website process(es) (akaApp Pools
).eg.
It also makes it easier to manage because you don't have to hunt through the folder structures to find any/all websites.
But technically, it can be (more or less) anywhere - just needs to have the correct permissions set.
Bonus Answer
I also remove the Default Website from IIS .. which in effect means I can also delete
c:\inetpub\wwwroot
.您可以将网站放在服务器硬盘上的任何位置,只需确保它是一个安全文件夹,而且我建议不要将其放在同一个操作系统驱动器中,以防它失败并且您需要对其进行格式化。
C:\inetpub\wwwroot 和 C:\inetpub 只是默认位置而已。
You can put the website any where on the server hard disk, Just make sure it is a secure folder and also I recommend to don't put it in the same OS drive, in case it failed and you needed to formate it.
C:\inetpub\wwwroot and C:\inetpub are just the default places nothing more.
实际上取决于生产服务器的配置方式以及操作方式。通常,我们在服务器上设置第二个“数据”驱动器有几个原因:
a) 过去,有很多典型的攻击,攻击者会尝试从 c:\inetpub 导航到 c:\winnt\cmd 。EXE文件。将东西放在不同的驱动器上可以防止这种情况发生。
b) 恢复——如果操作系统被破坏,您可以非常轻松地重新安装/重新映像或将数据磁盘移动到另一个盒子并快速恢复正常。
c)通常更容易做一些事情,比如交换非操作系统磁盘,以防您需要更多的磁盘空间或更快的磁盘或其他什么。
基本上,关闭操作系统驱动器是一个好主意。尽管虚拟化和现代部署工具使很多事情变得不那么重要。
Really depends on how the production server is configured and how operations likes to operate over there. Typically we setup a second "data" drive on servers for a few reasons:
a) Back in the old days, there were a lot of cannonical attacks where the attacker would try to navigate from c:\inetpub to c:\winnt\cmd.exe. Putting things on a different drive prevented this sort of thing.
b) Recovery -- if the OS gets hosed, you can pretty easily reinstall/reimage or move the data disks to another box and get things stood up fast.
c) Typically is lots easier to do things like swap the non-os disk in case you need more disk space or faster disks or whatever.
Basically, off the OS drive is a good idea. Though virtualization and modern deployment tools make lots of this matter less.