2013-09-03 6 views
0

내가 프로그래밍 다음 코드를 사용하여 IIS 6 (윈도우 서버 2003R2)에 대한 응용 프로그램 풀을 생성하지만, ManagedPipelineMode은 프로그래밍 응용 프로그램 풀을 생성, 오류 설정 "ManagedPipelineMode"

을 설정하려고하는 줄에 오류를 얻고있다

시도 1

 string metabasePath = @"IIS://localhost/W3SVC/AppPools"; 

     DirectoryEntry apppools = new DirectoryEntry(metabasePath); 
     DirectoryEntry newpool = apppools.Children.Add(AppPoolName, "IIsApplicationPool"); 
     newpool.Properties["managedRuntimeVersion"].Value = "v4.0"; 
     newpool.InvokeSet("ManagedPipelineMode", new Object[] { 0 }); //exception thrown on this line 
     newpool.Properties["Enable32BitAppOnWin64"].Value = true; 
     if (!string.IsNullOrEmpty(username)) 
     { 
      newpool.Properties["AppPoolIdentityType"].Value = 3; 
      newpool.Properties["WAMUserName"].Value = username; 
      newpool.Properties["WAMUserPass"].Value = password; 
     } 
     newpool.CommitChanges(); 

시도 2 ​​

 string metabasePath = @"IIS://localhost/W3SVC/AppPools"; 

     DirectoryEntry apppools = new DirectoryEntry(metabasePath); 
     DirectoryEntry newpool = apppools.Children.Add(AppPoolName, "IIsApplicationPool"); 
     newpool.Properties["managedRuntimeVersion"].Value = "v4.0"; 
     newpool.Properties["ManagedPipelineMode"][0] = 0; //exception thrown on this line 
     newpool.Properties["Enable32BitAppOnWin64"].Value = true; 
     if (!string.IsNullOrEmpty(username)) 
     { 
      newpool.Properties["AppPoolIdentityType"].Value = 3; 
      newpool.Properties["WAMUserName"].Value = username; 
      newpool.Properties["WAMUserPass"].Value = password; 
     } 
     newpool.CommitChanges(); 
0,123,516

같은 예외가 발생합니다.

는 예외 :

Exception from HRESULT: 0x80005006 
    at System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.PutEx(Int32 lnControlCode, String bstrName, Object vProp) 
    at System.DirectoryServices.PropertyValueCollection.OnClearComplete() 
    at System.DirectoryServices.PropertyValueCollection.set_Value(Object value) 

답변

0

내 문제는 내가 생각했던 것보다 좀 더 근본적인이었다 밝혀졌습니다. 우선 IIS 6은 통합 파이프 라인 모드를 지원하지 않으므로 스위치 ManagedPipelineMode은 존재하지 않습니다. 또한 Enable32BitAppOnWin64은 이러한 방식으로 존재하지 않으며 해당 기능을 켜기 위해 명령을 실행해야합니다 (http://extended64.com/blogs/rhoffman/archive/2005/05/10/482.aspx)