下面有一些可怕的错误,但我无法弄清楚什么。 虽然该网站创建为一种魅力,但应该与其关联的应用程序池根本不会创建。为什么IIS应用程序池完全没有创建?
public string Create(string sitename)
{
try
{
using (ServerManager serverMgr = new ServerManager())
{
string strhostname = sitename + "." + domain;
string bindinginfo = ":80:" + strhostname;
if (!IsWebsiteExists(serverMgr.Sites, strhostname))
{
Site mySite = serverMgr.Sites.Add(strhostname, "http", bindinginfo, "C:\\admin\\" + domain);
ApplicationPool newPool = serverMgr.ApplicationPools.Add(strhostname);
newPool.ManagedRuntimeVersion = "v4.0";
newPool.ManagedPipelineMode = ManagedPipelineMode.Integrated;
serverMgr.CommitChanges();
return "Website " + strhostname + " added sucessfully";
}
else
{
return "Name should be unique, " + strhostname + " already exists.";
}
}
}
catch (Exception ex)
{
return ex.Message;
}
}
我在做什么错在这里?
绑定信息无效“:80:东西”。你需要解决这个问题。尝试“*:80:某事”。 –
@LexLi谢谢你,我按要求做了,但问题仍然存在 – OrElse
你的代码并不是只有一个问题,而是很多。你将不得不找到合适的样本开始。 –