Are you running this code inside the worker process for default web site - in case, it does not work by design - the IIS7 UI creates each website in its own unique app-pool and with config isolation, each app-pool does not have access to configuration for
another app-pool. If you really want the sites to read each other's information, you need to move them to the same app-pool.
Anil Ruia
Software Design Engineer
IIS Core Server
yes i am running this code from the default website which is under a seperate application pool. I did notice that IIS 7 Manager automatically created a unique app-pool when i created the new website.
For our application, i guess we can live with the scenario of using the same worker process across multiple websites, althought it mighe be an inconvenience to our customers plus we will need to document it.
Just wondering- what was the rationale for config isolation across multiple app-pools?
We want to ensure that web applications don't interfere with each other. The site boundary is a a good fit and we will probably go forward with this concept in the future.
Thomas Deml
Group Program Manager
Internet Information Services
Microsoft Corp.
.OpenWebConfiguration("/simple",
"Default Web Site",
null,
"<remote-machine-name>");
Unable to cast COM object of type 'System.__ComObject' to interface type 'System.Web.Configuration.IRemoteWebConfigurationHostServer'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{A99B591A-23C6-4238-8452-C7B0E895063D}'
failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155).
This, even after remote configuration was enabled on the remote machine using
At the minimum, you’ll need to run aspnet_regiis -config+ on the client machine. You’ll also need to make sure that our DCOM object can be activated. The best article I could find on this was the following:
http://support.microsoft.com/kb/947206/.
And lastly, the remote machine needs to have IIS6 Management Compatibility installed.
Hope this helps.
Thomas Deml
Group Program Manager
Internet Information Services
Microsoft Corp.
nikhilzkingd...
11 Posts
Unable to open web configuration on non default websites
Apr 24, 2008 05:35 AM|LINK
An exception is thrown when attempting to open the web configuration for a web application on a non default website.
System.InvalidOperationException: Failed to resolve the site ID for 'NonDefaultWebSite'
Steps to reproduce
1. Create a new website (on a port other than 80) called 'NonDefaultWebSite'
2. Create a simple web application on that website called 'mySite'
3. Try opening the web.config for that web application ( NonDefaultWebSite/mySite/web.config) using the following code (from a seperate application)
WebConfigurationManager.OpenWebConfiguration("/mySite", "NonDefaultWebSite", null, Environment.MachineName);
This works on IIS 6 and for default websites on IIS 7.
thomad
552 Posts
Re: Unable to open web configuration on non default websites
Apr 24, 2008 06:10 AM|LINK
I did what you wrote and it works fine on IIS7:
Configuration config = WebConfigurationManager.OpenWebConfiguration("/test", "DemoSite", null, Environment.MachineName); CompilationSection compilation = (CompilationSection)config.GetSection("system.web/compilation");label.Text =
"debugging enabled: " + compilation.Debug;Group Program Manager
Internet Information Services
Microsoft Corp.
anilr
2343 Posts
Microsoft
Re: Unable to open web configuration on non default websites
Apr 24, 2008 03:05 PM|LINK
Are you running this code inside the worker process for default web site - in case, it does not work by design - the IIS7 UI creates each website in its own unique app-pool and with config isolation, each app-pool does not have access to configuration for another app-pool. If you really want the sites to read each other's information, you need to move them to the same app-pool.
Software Design Engineer
IIS Core Server
nikhilzkingd...
11 Posts
Re: Unable to open web configuration on non default websites
Apr 24, 2008 03:20 PM|LINK
Anil,
yes i am running this code from the default website which is under a seperate application pool. I did notice that IIS 7 Manager automatically created a unique app-pool when i created the new website.
For our application, i guess we can live with the scenario of using the same worker process across multiple websites, althought it mighe be an inconvenience to our customers plus we will need to document it.
Just wondering- what was the rationale for config isolation across multiple app-pools?
thanks
thomad
552 Posts
Re: Unable to open web configuration on non default websites
Apr 24, 2008 03:50 PM|LINK
We want to ensure that web applications don't interfere with each other. The site boundary is a a good fit and we will probably go forward with this concept in the future.
Group Program Manager
Internet Information Services
Microsoft Corp.
nikhilzkingd...
11 Posts
Re: Unable to open web configuration on non default websites
Apr 24, 2008 03:59 PM|LINK
Fair enough, but how would this play out across machine boundaries which cannot share application pools.
What if i passed in a remote machine name as the last parameter.
WebConfigurationManager.OpenWebConfiguration("/test", "DemoSite", null, "RemoteMachineName");
This works in IIS 6 and 5. I'm trying this out on IIS 7 as we speak.
thanks
nikhilzkingd...
11 Posts
Re: Unable to open web configuration on non default websites
Apr 24, 2008 04:14 PM|LINK
Sure enough, it fails
WebConfigurationManager
.OpenWebConfiguration("/simple", "Default Web Site", null, "<remote-machine-name>");Unable to cast COM object of type 'System.__ComObject' to interface type 'System.Web.Configuration.IRemoteWebConfigurationHostServer'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{A99B591A-23C6-4238-8452-C7B0E895063D}' failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155).
This, even after remote configuration was enabled on the remote machine using
aspnet_regiis –config+
thomad
552 Posts
Re: Unable to open web configuration on non default websites
Apr 25, 2008 04:23 AM|LINK
Nikhil,
This is an ASP.NET interface you are using. I have to ask the ASP.Net guys. Stay tuned.
Group Program Manager
Internet Information Services
Microsoft Corp.
thomad
552 Posts
Re: Unable to open web configuration on non default websites
May 06, 2008 03:22 AM|LINK
Nikhil,
Here is what I got from the ASP.NET team:
At the minimum, you’ll need to run aspnet_regiis -config+ on the client machine. You’ll also need to make sure that our DCOM object can be activated. The best article I could find on this was the following: http://support.microsoft.com/kb/947206/.
And lastly, the remote machine needs to have IIS6 Management Compatibility installed.
Hope this helps.
Group Program Manager
Internet Information Services
Microsoft Corp.
nikhilzkingd...
11 Posts
Re: Unable to open web configuration on non default websites
May 06, 2008 03:27 AM|LINK
Thanks Thomad,
that was the solution that i got from the support call with the ASP.Net team.