使用C#创建Web共享失败,没有错误

我想在特定的文件夹Web共享上创建(在IIS上)。 我没有在日志中有任何错误但是没有创建共享(下面的代码)。 在事件查看器中,我看到两个“服务控制管理器”错误 答:万维网发布服务服务意外终止。它完成了这2次。 B. IIS Admin Service服务意外终止。它完成了这2次。 此代码在其他3台机器上运行良好,我怀疑它是环境问题,帮助将不胜感激。
// create a web shared for the audio path
IISVirtualRoot vRoot = new IISVirtualRoot();
string errorOut;
string RootWeb = "IIS://localhost/W3SVC/1/Root";
string inPhysicalDirectory =  Path.Combine(index.TargetDir, "WAVS_" + index.ID);
string VirtualDirectory =  "WAVS_" + index.ID;

vRoot.Create(RootWeb, inPhysicalDirectory, VirtualDirectory, out errorOut);
    
已邀请:
是的,我使用System.EnterpriseServices.Internal     

要回复问题请先登录注册