在不同的服务器上连接IIS

时间:2018-05-07 07:04:42

标签: c# iis server

我在另一台机器上安装了IIS,我需要连接,而且我无法这样做。 怎么可能呢?

我的添加池功能:

private string addPool(string companyName, string serverName) 
        {
            string errorMsg = string.Empty;
            string result = run_AC("add apppool /name:" + companyName, serverName);
            if (result.EndsWith("added" + Environment.NewLine))
                errorMsg = string.Empty;//"Create application pool ... OK";
            else if (result.StartsWith("ERROR ( message:Failed to add duplicate collection element"))
                errorMsg = "Create application pool ... already exists";
            else
                errorMsg = "Create application pool ... failed - ";

            return errorMsg;
        } 
</code>
<code>
private string siteCreation(string companyName, string BaseSite, string envirementFolderPath, string serverName)
        {
            string errorMsg = string.Empty;
            string result = run_AC("add app /site.name:\"" + BaseSite + "\" /app.name:" + companyName + " /path:/" + companyName + " \"/physicalPath:" + envirementFolderPath + "\" /applicationPool:" + companyName, serverName);
            if (result.EndsWith("added" + Environment.NewLine))
                errorMsg += string.Empty;// "Create app ... OK";
            else if (result.StartsWith("ERROR ( message:Failed to add duplicate collection element"))
                errorMsg += "Create app ... already exists";
            else
                errorMsg += "Create app ... failed - " + result;

            return errorMsg;
        }

private string addPool(string companyName, string serverName) { string errorMsg = string.Empty; string result = run_AC("add apppool /name:" + companyName, serverName); if (result.EndsWith("added" + Environment.NewLine)) errorMsg = string.Empty;//"Create application pool ... OK"; else if (result.StartsWith("ERROR ( message:Failed to add duplicate collection element")) errorMsg = "Create application pool ... already exists"; else errorMsg = "Create application pool ... failed - "; return errorMsg; } </code> <code> private string siteCreation(string companyName, string BaseSite, string envirementFolderPath, string serverName) { string errorMsg = string.Empty; string result = run_AC("add app /site.name:\"" + BaseSite + "\" /app.name:" + companyName + " /path:/" + companyName + " \"/physicalPath:" + envirementFolderPath + "\" /applicationPool:" + companyName, serverName); if (result.EndsWith("added" + Environment.NewLine)) errorMsg += string.Empty;// "Create app ... OK"; else if (result.StartsWith("ERROR ( message:Failed to add duplicate collection element")) errorMsg += "Create app ... already exists"; else errorMsg += "Create app ... failed - " + result; return errorMsg; }

0 个答案:

没有答案