2010-04-12 4 views
0

Microsoft.Web.Administration dll을 사용하여 IIS7에서 별도의 워크 플로 인스턴스를 응용 프로그램으로 만들려고합니다. 그것은 내가 COM 오류가 ApplicationsCollection 사이트에 응용 프로그램을 추가하려고 시도 할 때 : "잘못된 응용 프로그램 경로를 \ r은 n \"virtualPath에 할당MS.Web.Admin을 통해 IIS7에서 웹 응용 프로그램 만들기

using (ServerManager manager = new ServerManager()) 
      { 
       var site = manager.Sites.Where(x => x.Name == Properties.Settings.Default.WorkflowWebsiteName).Single(); 

       StringBuilder stringBuilder = new StringBuilder() 
        .Append(m_workflowDefinition.AccountId) 
        .Append("/") 
        .Append(m_workflowDefinition.WorkflowDefinitionId) 
        .Append("/") 
        .Append(m_workflowDefinition.Version) 
        .Append("/"); 

       string virtualPath = stringBuilder.ToString(); 
       string physicalPath = Properties.Settings.Default.ApplicationPoolString + 
             virtualPath.Replace("/", "\\"); 

       if (!Directory.Exists(physicalPath)) Directory.CreateDirectory(physicalPath); 

       //Create the workflow service definition file 
       using (StreamWriter writer = new StreamWriter(Path.Combine(physicalPath, m_workflowDefinition.WorkflowName + WORKFLOW_FILE_EXTENSION))) 
       { 
        writer.Write(m_workflowDefinition.Definition); 
       } 

       //Copy dependencies      
       string dependencyPath = m_workflowDefinition.DependenciesPath; 
       CopyAll(new DirectoryInfo(dependencyPath), new DirectoryInfo(physicalPath)); 

       //Create a new IIS application for the workflow 
       var apps = site.Applications.Where(x => x.Path == virtualPath); 
       if (apps.Count() > 0) 
       { 
        site.Applications.Remove(apps.Single()); 
       } 
       Application app = site.Applications.Add(virtualPath, physicalPath); 

       app.ApplicationPoolName = "Workflow AppPool"; 
       app.EnabledProtocols = PROTOCOLS; 

       manager.CommitChanges(); 
      } 

값은 같은 것입니다 :는 "뭔가/일/무엇인가"와 physicalPath는 "c : \ inetpub \ wwwroot \ Workflow \ something \ something \ something"입니다. 어떤 아이디어?

도움을 주시면 대단히 감사하겠습니다.

답변

1

"something/something/something"경로를 "/ something/something/something"으로 변경해보십시오. IIS 관리 호출에는 경로 시작 부분에 추가 슬래시가 필요합니다.

+0

감사합니다. 그것은 정확히 문제였습니다. –