예, 당신은 IIS 관리 API의 구성 편집기 클래스를 사용하여 런타임시의 web.config를 수정하는 역할을 변경할 수 있습니다. 나는 이것을 시도하지는 않았지만, 시작할 때 Azure 설정에서 설정을로드 한 다음 역할의 런타임 인스턴스에 적용 할 수 있어야합니다. 따라서 웹 역할의 global.asax의 Application_start 섹션에서이를 설정할 수 있습니다.
또는 시작 작업을 사용하여 역할 시작 시간에 web.config를 프로그래밍 방식으로 빌드 할 수 있습니다.
이 IIS의 포럼 게시물 iis.net에서 몇 가지 조사를 수행 한 후 읽기 : 1 방식의 경우
http://forums.iis.net/t/1150481.aspx
사용자 ruslany에서 샘플을 채취을 (여기서 인해 신용을 제공하지만, 그래서 붙여 넣기 그것을보십시오) :
using(ServerManager serverManager = new ServerManager()) {
Configuration config = serverManager.GetWebConfiguration("Default Web Site");
ConfigurationSection rulesSection = config.GetSection("system.webServer/rewrite/rules");
ConfigurationElementCollection rulesCollection = rulesSection.GetCollection();
ConfigurationElement ruleElement = rulesCollection.CreateElement("rule");
ruleElement["name"] = @"MyTestRule";
ruleElement["stopProcessing"] = true;
ConfigurationElement matchElement = ruleElement.GetChildElement("match");
matchElement["url"] = @"foo\.asp";
ConfigurationElement conditionsElement = ruleElement.GetChildElement("conditions");
ConfigurationElementCollection conditionsCollection = conditionsElement.GetCollection();
ConfigurationElement addElement = conditionsCollection.CreateElement("add");
addElement["input"] = @"{HTTP_HOST}";
addElement["pattern"] = @"www\.foo\.com";
conditionsCollection.Add(addElement);
ConfigurationElement actionElement = ruleElement.GetChildElement("action");
actionElement["type"] = @"Rewrite";
actionElement["url"] = @"bar.asp";
rulesCollection.Add(ruleElement);
serverManager.CommitChanges();
}