C# 无法在IIS7及以上版本中创建动态web应用程序
成功调用以下方法后,无法在IIS中查看应用程序:C# 无法在IIS7及以上版本中创建动态web应用程序,c#,iis-7,virtual-directory,C#,Iis 7,Virtual Directory,成功调用以下方法后,无法在IIS中查看应用程序: ServerManager serverMgr = new ServerManager(); Configuration config = serverMgr.GetApplicationHostConfiguration(); ConfigurationSection isapiCgiRestrictionSection = config.GetSection("system.webServer/security/isapiCgiRestric
ServerManager serverMgr = new ServerManager();
Configuration config = serverMgr.GetApplicationHostConfiguration();
ConfigurationSection isapiCgiRestrictionSection = config.GetSection("system.webServer/security/isapiCgiRestriction");
ConfigurationElementCollection isapiCgiRestrictionCollection = isapiCgiRestrictionSection.GetCollection();
//ConfigurationElement addElement = isapiCgiRestrictionCollection.CreateElement("add");
//addElement["path"] = @"C:\Inetpub\wwwroot\";
//addElement["allowed"] = true;
//addElement["groupId"] = @"ContosoGroup";
//addElement["description"] = @"Contoso Extension";
//isapiCgiRestrictionCollection.Add(addElement);
//serverMgr.CommitChanges();
Site defaultSite = serverMgr.Sites["PharmaConnect"];
defaultSite.Applications.Add("/blogs3", @"C:\inetpub\wwwroot\blogs1");
serverMgr.CommitChanges();
我不知道如何通过c代码动态创建子域。我们只是尝试实现上面的内容。但无法在iis中查看应用程序/虚拟目录
我已尝试,但没有成功。您可以通过以下代码在IIS中创建动态Web应用程序,并确保Visual Studio在管理员模式下打开,因为在IIS中创建Web应用程序时发现访问被拒绝的问题 --Web配置文件
<!---Default format is IIS://<your server name>/W3SVC-->
<add key="metabasePath" value="IIS://JAYDEV/W3SVC"/>
<!--Framework version of newly created website-->
<add key="frameworkVersion" value="4.0"/>
<!---Local path of newly created website -->
<add key="defaultFileLocation" value="C:\inetpub\wwwroot\Dynamic1"/>
<!---Application Pool of newly created website-->
<add key="defaultAppPool" value="DynamicPool"/>
您可以通过以下代码在IIS中创建动态Web应用程序,并确保Visual Studio在管理员模式下打开,因为在IIS中创建Web应用程序时发现访问被拒绝的问题 --Web配置文件
<!---Default format is IIS://<your server name>/W3SVC-->
<add key="metabasePath" value="IIS://JAYDEV/W3SVC"/>
<!--Framework version of newly created website-->
<add key="frameworkVersion" value="4.0"/>
<!---Local path of newly created website -->
<add key="defaultFileLocation" value="C:\inetpub\wwwroot\Dynamic1"/>
<!---Application Pool of newly created website-->
<add key="defaultAppPool" value="DynamicPool"/>
您可以通过以下代码在IIS中创建动态Web应用程序,并确保Visual Studio在管理员模式下打开,因为在IIS中创建Web应用程序时发现访问被拒绝的问题 --Web配置文件
<!---Default format is IIS://<your server name>/W3SVC-->
<add key="metabasePath" value="IIS://JAYDEV/W3SVC"/>
<!--Framework version of newly created website-->
<add key="frameworkVersion" value="4.0"/>
<!---Local path of newly created website -->
<add key="defaultFileLocation" value="C:\inetpub\wwwroot\Dynamic1"/>
<!---Application Pool of newly created website-->
<add key="defaultAppPool" value="DynamicPool"/>
您可以通过以下代码在IIS中创建动态Web应用程序,并确保Visual Studio在管理员模式下打开,因为在IIS中创建Web应用程序时发现访问被拒绝的问题 --Web配置文件
<!---Default format is IIS://<your server name>/W3SVC-->
<add key="metabasePath" value="IIS://JAYDEV/W3SVC"/>
<!--Framework version of newly created website-->
<add key="frameworkVersion" value="4.0"/>
<!---Local path of newly created website -->
<add key="defaultFileLocation" value="C:\inetpub\wwwroot\Dynamic1"/>
<!---Application Pool of newly created website-->
<add key="defaultAppPool" value="DynamicPool"/>
谢谢鼓励性反馈谢谢鼓励性反馈谢谢鼓励性反馈谢谢鼓励性反馈谢谢鼓励性反馈谢谢鼓励性反馈谢谢鼓励性反馈