Gentlemen,
I have trouble operating the SolidCP with IIS8.5 and Windows Server 2012 R2, when trying to create a web site has the following error message:
[9/10/2016 5:30:37 PM] ERROR: ‘Internet Information Services 8.0’ SiteIdExists
System.Runtime.InteropServices.COMException (0x8007000D): Invalid site name
at Microsoft.Web.Administration.Interop.IAppHostProperty.set_Value(Object value)
at Microsoft.Web.Administration.ConfigurationElementCollectionBase`1.FindElementWithCollectionKey(String elementName, String collectionKey, Object value)
at Microsoft.Web.Administration.SiteCollection.get_Item(String name)
at SolidCP.Providers.Web.Iis.WebObjects.WebObjectsModuleService.SiteExists(ServerManager srvman, String siteId)
at SolidCP.Providers.Web.IIs70.SiteExists(String siteId)
at SolidCP.Server.WebServer.SiteExists(String siteId)
I appreciate any help.
Thank you
Hello,
Just double checking something:
The fixes you make they have to work with the SolidCP Portal code aswell. (not just adjusted so they work with your frontend/ scripts)
As currently everything works for Portal / Enterprise / Server (and has to stay that way ofcourse).
the way to contribute is:
1) make sure you have a signed contributor license: https://solidcp.com/contributors/contributors-license-agreement/
2) In our Git make your own fork
3) Apply the fixes to your fork, and submit a merge request with our master
4) One of the management will check/ verify the code and accept the merge request
Regards,
Marco
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!
Hello Marco,
I will take the tests using the same functions IIS6 and post the result here.
Thank you for now.
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,
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 Marco,
I appreciate your efforts to help me! Well, let’s questions:
- SolidCP Server module is installed on that server? (i assume so ofc)
- yes, I did the installation by the installer.
- SolidCP Server application pool user has Administrator rights?
- yes, it is automatically configured by the installer.
- Is the SolidCP Server the same version as portal?
- I do not use the SolidCP Portal, only use the SolidCP Server module to administer IIS. I have a own application that consumes the SolidCP Server services. You may be finding it strange, but my control panel meets other services my business. This already worked a long time with WebsitePanel (IIS6) and decided to migrate to SolidCP to admire the excellent work you have been developing. That migration worked all as expected in Windows Server 2003, but unfortunately I am with this issue in the 2012 version (IIS8.5).
Thanks!