您的位置:首页 > 编程语言 > C#

c#操作IIS 添加SSL出现的问题

2010-01-26 11:00 375 查看
我用同一个IP绑定不同站点,都添加了SSL,证书是同一个,
在服务器上用shell命令执行下面命令:
cscript.exe c:InetpubAdminScriptsadsutil.vbs set /w3svc/******/SecureBindings ":443:mysite.com"
可以添加IIS;
但我用c#写的程序在本地执行时,报错:
CScript 错误: 加载脚本“c:InetpubAdminScriptsadsutil.vbs”失败(拒绝访问。 )。
不知道是不是权限的问题,于是我在服务器上把adsutil.vbs的权限设置为erveryone后,又报了
没有权限
ErrNumber: 70 (0x46)
Error Trying To SET the Property: SecureBindings
这样的错;谁能帮我解决这个问题

执行Shell命令的代码如下:
string command= @"cscript.exe c:InetpubAdminScriptsadsutil.vbs set /w3svc/" + siteID + "/SecureBindings ":443:" + hostHeader + """;
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.Arguments = "/c " + command;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;

p.Start();
p.StandardInput.WriteLine(command);
p.StandardInput.WriteLine("exit");
log.Info("6:" + p.StandardOutput.ReadToEnd());
p.WaitForExit();
p.Close();



你的IIS里面是否已经有了这个网站了,你先在IIS里添加这个网站,然后将SSL端口配成444,再添加看看,如果没有加过这个站点,应该不可以使用这条命令



IIS的https一个端口只能有一个网站
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐