Friday, 15 May 2015

asp.net - Cant add bindings to IIS programatically - redirection.config permissions (with a video!) -



asp.net - Cant add bindings to IIS programatically - redirection.config permissions (with a video!) -

here video summary of problem http://screencast.com/t/v6th4burlhv

i trying add together bindings programtically iis code:

public void addbindings(string sitename, string hostname) { servermanager servermgr = new servermanager(); site mysite = servermgr.sites[sitename]; mysite.bindings.add("*:80:" + hostname, "http"); mysite.serverautostart = true; servermgr.commitchanges(); }

and error:

filename: redirection.config error: cannot read configuration file due insufficient permissions description: unhandled exception occurred during execution of current web request. please review stack trace more info error , originated in code. exception details: system.unauthorizedaccessexception: filename: redirection.config error: cannot read configuration file due insufficient permissions asp.net not authorized access requested resource. consider granting access rights resource asp.net request identity. asp.net has base of operations process identity (typically {machine}\aspnet on iis 5 or network service on iis 6 , iis 7, , configured application pool identity on iis 7.5) used if application not impersonating. if application impersonating via <identity impersonate="true"/>, identity anonymous user (typically iusr_machinename) or authenticated request user.

i have addressed permissions on redirection.config (both iusr , iis_iusrs have permissions)

as errors on web.config suggested here http://www.codeproject.com/questions/348972/error-cannot-read-configuration-file-due-to-insuff

but still doesn't work. suggestions much appreciated.

answer

websites don't run under iis group. whoever owns app pool user , user needs permission. or set user in iis_iusrs group.

asp.net iis binding

No comments:

Post a Comment