简体   繁体   English

使用 Microsoft.Web.Administration 以编程方式创建网站

[英]Using Microsoft.Web.Administration to programmatically create web sites

I'm using Microsoft.Web.Administration to create new websites on IIS 7.5我正在使用 Microsoft.Web.Administration 在 IIS 7.5 上创建新网站

 Using mgr As New ServerManager()
        mgr.ApplicationPools.Add(applicationPoolName)
....

it will work fine when using visual studio debug mode (F5) which will run on localhost:61044 (or whatever port)使用将在 localhost:61044(或任何端口)上运行的 Visual Studio 调试模式(F5)时,它会正常工作

However, when running on production site (or localhost) the following permission error will come up:但是,在生产站点(或本地主机)上运行时,会出现以下权限错误:

Redirection.config/ Error: Cannot read configuration file due to insufficient permissions Redirection.config/ 错误:由于权限不足,无法读取配置文件

I've tried setting READ permissions for IUSR and DefaultAppPool users for C:\\Windows\\System32\\inetsrv\\config (folder) and C:\\Windows\\System32\\inetsrv\\config\\redirection.config (file)我已经尝试为 C:\\Windows\\System32\\inetsrv\\config(文件夹)和 C:\\Windows\\System32\\inetsrv\\config\\redirection.config(文件)的 IUSR 和 DefaultAppPool 用户设置 READ 权限

I'm assuming it's a permission issue, but I have not figured out or found a solution.我假设这是一个权限问题,但我还没有想出或找到解决方案。

when you are in vs the process is running as you... you could always test by setting the app pool user to an administrator.当您在 vs 进程正在运行时……您始终可以通过将应用程序池用户设置为管理员来进行测试。 or just your user identity.或者只是您的用户身份。 Then once you know it works... tinker around with giving various permissions to the folder those files are in.然后,一旦你知道它有效......修补这些文件所在的文件夹的各种权限。

That being said... setting the app pool user to localsystem should solve the issue too.话虽如此……将应用程序池用户设置为 localsystem 也应该可以解决问题。 localsystem gives the process admin rights so this might not be appropriate if the app is externally facing. localsystem 授予进程管理员权限,因此如果应用程序面向外部,这可能不合适。 If it is an intranet app then it might be ok...如果它是一个内网应用程序,那么它可能没问题...

otherwise you will need to figure out the exact permissions you need which sorry I don't actually know.否则,您将需要弄清楚您需要的确切权限,抱歉,我实际上并不知道。

我在路径C:\\Windows\\System32\\inetsrv\\config找到了Redirection.config ,在我的情况下,我将读取权限添加到 IIS_Iuser 并解决了问题。

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

相关问题 使用Microsoft.Web.Administration将AspNetCore参数添加到IIS应用程序 - Add AspNetCore argument to IIS application using Microsoft.Web.Administration .Net Core和Microsoft.Web.Administration - .Net Core and Microsoft.Web.Administration 如何使用Microsoft.Web.Administration添加子应用程序? - How to add child application using Microsoft.Web.Administration? 停止网站Microsoft.Web.Administration AccessDenied - Stopping WebSite Microsoft.Web.Administration AccessDenied Microsoft.Web.Administration内存泄漏 - Microsoft.Web.Administration memory leak 如何引用 Microsoft.Web.Administration? - How to reference Microsoft.Web.Administration? 使用Microsoft.Web.Administration后无法启动IIS Express Web服务器 - Unable to launch the IIS Express Web Server after using Microsoft.Web.Administration 如何使用Microsoft.Web.Administration在远程计算机上的web.config中操纵appsettings? - How can I manipulate appsettings in a web.config on a remote machine using Microsoft.Web.Administration? 使用Microsoft.Web.Administration将ISAPI筛选器添加到现有站点 - Add an ISAPI Filter to an existing Site with Microsoft.Web.Administration 使用Microsoft.Web.Administration库创建IIS应用程序创建两个应用程序而不是一个 - IIS application creation by using Microsoft.Web.Administration library creates two application instead of one
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM