IISExpress 8 with custom configuration file - web service won't load

0

When I develop a WCF service or website solution, I always use IISExpress with a custom configuration file so I can share the setup with other developers in the team. Basically, I run a batch file with the following command in it:

"C:\Program Files (x86)\IIS Express\iisexpress.exe" /config:service-hosts.config

Where service-hosts.config is the path to my custom configuration file.

This method has been working perfectly fine, and still works fine in other solutions on my PC (each with their own service-hosts.config file). However, I've just started having a problem loading a WCF service using this method. I'm getting the following error when trying to browse to the service root dir, or any of the built in help endpoints:


HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.

Detailed Error Information:

Module IIS Web Core

Notification Unknown

Handler Not yet determined

Error Code 0x80070003

Config Error Cannot read configuration file

Config File \?\D:\Projects\MyProject\WCFSite\web.config

Requested URL http:// localhost:80/

Physical Path

Logon Method Not yet determined

Logon User Not yet determined

Request Tracing Directory C:\Users\Spikeh\Documents\IISExpress\TraceLogFiles\

Config Source:

-1:

0: 

More Information:

This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.

If you see the text "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined", this error is because you are running a .NET Framework 3.5-based application in .NET Framework 4. If you are running WebMatrix, to resolve this problem, go to the Settings node to set the .NET Framework version to ".NET 2". You can also remove the extra sections from the web.config file.

View more information ยป


I've been debugging for hours and can't get this error to change, let alone fix it.

I've tried overwriting my service-hosts.config file with a few different versions of applicationHosts.config, running IISExspress in 64bit, replacing the web.config file with a very basic version, setting permissions on the directory (to the point where every user on my PC has access), and changing the app pool, but still no change.

The weird thing is... when I change the WCF project to use "IISExpress" in the Web section of project properties, then subsequently debug the project, everything works fine... even with all of my web.config settings in place.

This points to how I'm running IISExpress, or my service-hosts.config file... though the service-hosts.config file (with slight modifications for the sites involved) is exactly the same as it is in my other projects.

One thing to note (might be a red herring), but I did downgrade the solution from VS2012 to VS2010, and changed the framework target to .Net 4.0... not sure if something might be configured funny due to that?

Does anyone have any ideas? I'm at the point of jumping off the roof...

UPDATE:

Here's the debug information from IISExpress (running with /trace:e):

    Running IIS...
    Starting IIS Express ...
    Initializing the W3 Server Started CTC = 5514916
    PreInitSitesThread: Premature Exit Occured ( hr = 80070003 )
    W3 Server initializing WinSock.  CTC = 5514916
    W3 Server WinSock initialized.  CTC = 5514916
    W3 Server ThreadPool initialized (ipm has signalled).  CTC = 5514916
    Start listenerChannel http:0
    Successfully registered URL "http://*:80/" for site "MyWebsite" application "/"
    Registration completed for site "MyWebsite"
    AppPool 'MyCustomAppPool' initialized
    InitComplete event signalled
    IIS Express is running.
    Enter 'Q' to stop IIS Express
    IncrementMessages called
    Request ended: http://localhost:80/ with HTTP status 500.19

And here's the important part of my service-hosts.config:

<applicationPools>
    <add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" />
    <add name="Clr4ClassicAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" />
    <add name="Clr2IntegratedAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" />
    <add name="Clr2ClassicAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" />
    <add name="UnmanagedClassicAppPool" managedRuntimeVersion="" managedPipelineMode="Classic" autoStart="true" />
    <add name="IISExpressAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" />

    <add name="MycustomAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />

    <applicationPoolDefaults managedRuntimeLoader="v4.0" >
        <processModel/>
    </applicationPoolDefaults>
</applicationPools>

<listenerAdapters>
    <add name="http" />
</listenerAdapters>

<sites>
    <site name="MyWebsite" id="1">
        <application path="/" applicationPool="MyCustomAppPool">
            <virtualDirectory path="/" physicalPath="D:\Projects\MyProject\WCFSite\" />
        </application>
        <bindings>
            <binding protocol="http" bindingInformation="*:80:" />
        </bindings>
    </site>
    <siteDefaults>
        <logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
        <traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
    </siteDefaults>
    <applicationDefaults applicationPool="Clr4IntegratedAppPool" />
    <virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>

<webLimits />

web-config
iis-express
asked on Stack Overflow Feb 22, 2013 by Spikeh • edited Feb 22, 2013 by Spikeh

1 Answer

1

Seems that the service-hosts.config file was pointing to something it shouldn't have been pointing to. I replaced my service-hosts.config with an copy from an older project (and therefore an older version of IISExpress / .Net Framework) and everything works fine.

Sounds like it was to do with my 4.5 -> 4.0 downgrade after all.

answered on Stack Overflow Feb 25, 2013 by Spikeh

User contributions licensed under CC BY-SA 3.0