ah,
So your just using the soap calls on the SolidCP Server?
In that case i will have to check on changes to the IIS 8.5 module (there have been quite a few and still some on the making).
I guess it will take + - 72 hours before i can give a better answer on that (for the first time in ages i am more or less taking the weekend semi-off to relax some, so first chance i get to dig in this is monday).
One thing i can say straight off the bat: in 2003 the Website ID was an actual ID, while in 8.0 and up it's just domain.com (no actual ID like before)
Hi Marco,
That's right! I see that at No SolidCP have modules only IIS8, I believe it is the same for 8.5.
Note that the return behavior of ID is:
When the domain name already exists in IIS => returns the domain name (domain.com)
When the domain does not exist in IIS => returns null
Stay calm when your check! I do not want to mess up your weekend. 🙂
Best Regards!
Hello,
Ok i checked the code and for IIS 7 / 8 it uses:
public override bool SiteExists(string siteId)
{
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
return webObjectsSvc.SiteExists(srvman, siteId);
}
}
While for IIS 6 it uses:
public virtual bool SiteExists(string siteId)
{
return (wmi.ExecuteQuery(
String.Format("SELECT * FROM IIsWebServerSetting WHERE Name='{0}'", siteId)).Count > 0);
}
for IIS 7/8:
The SideID is domain.com , and if it doesn't exist it should return a null value
Nothing more to it.
For IIS 6:
public string GetSiteId(string siteName)
{
string siteId = null;
ManagementObjectCollection objSites = wmi.ExecuteQuery(
String.Format("SELECT * FROM IIsWebServerSetting WHERE ServerComment='{0}'", siteName));
foreach (ManagementObject objSite in objSites)
siteId = (string)objSite.Properties["Name"].Value;
return siteId;
}
Which might need to be adjusted into your code?
as the siteID is simply handled different compared to IIS 6,
Hello Marco,
I will take the tests using the same functions IIS6 and post the result here.
Thank you for now.
Hello Marco,
I managed to solve the problem, I found the error in IIS7 class, I'll post the solution below:
Problem
Error trying to create a new website through IIS8.5 get the error below, this does not apply in IIS6. I could not do a test on IIS7 to see if the problem extends to it.
Error
ERROR: ‘Internet Information Services 8.0’ SiteIdExists
System.Runtime.InteropServices.COMException (0x8007000D): Invalid site name
Scenario
Creation of a new website in IIS 8.5
Site Name: domain.com
IIS6
GetSiteId:[]
SiteExists:[False]
Result: OK
IIS8.5
GetSiteId:[]
SiteExists: Invalid site name
Result: ERROR
Solution
It was necessary to make a change in class: WebObjectsModuleService.cs, line: 453
FROM
public bool SiteExists(ServerManager srvman, string siteId)
{
return (srvman.Sites[siteId] != null);
}
TO
public bool SiteExists(ServerManager srvman, string siteId)
{
return (siteId == null ? false : srvman.Sites[siteId] != null);
}
SUMMARY
When a web site there is no GetSiteId function returns null when this occurs SiteExists function generates an error by looking for an element of the array that does not exist, to solve the problem just did a check before if the SiteName is null, we know that He does not exist.
Problem solved!!
Thankyou!