简体   繁体   中英

Using Microsoft.Web.Administration to programmatically create web sites

I'm using Microsoft.Web.Administration to create new websites on 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)

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

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)

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. 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 gives the process admin rights so this might not be appropriate if the app is externally facing. 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 并解决了问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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