带有自定义配置文件的IISExpress 8 - 不会加载Web服务

时间:2013-02-22 15:10:30

标签: web-config iis-express

当我开发WCF服务或网站解决方案时,我总是将IISExpress与自定义配置文件一起使用,以便我可以与团队中的其他开发人员共享设置。基本上,我使用以下命令运行批处理文件:

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

其中service-hosts.config是我的自定义配置文件的路径。

这种方法工作得很好,在我的PC上的其他解决方案中仍然可以正常工作(每个解决方案都有自己的service-hosts.config文件)。但是,我刚开始使用此方法加载WCF服务时遇到问题。尝试浏览服务根目录或任何内置帮助端点时,我收到以下错误:


HTTP错误500.19 - 内部服务器错误 无法访问请求的页面,因为页面的相关配置数据无效。

详细错误信息:

模块IIS Web核心

通知未知

处理程序尚未确定

错误代码0x80070003

配置错误无法读取配置文件

配置文件\?\ D:\ Projects \ MyProject \ WCFSite \ web.config

请求的URL http:// localhost:80 /

物理路径

登录方法尚未确定

登录用户尚未确定

请求跟踪目录C:\ Users \ Spikeh \ Documents \ IISExpress \ TraceLogFiles \

配置来源:

-1:

0: 

更多信息:

读取Web服务器或Web应用程序的配置文件时出现此错误。在某些情况下,事件日志可能包含有关导致此错误的更多信息。

如果您看到文本“有一个重复的'system.web.extensions / scripting / scriptResourceHandler'部分已定义”,则此错误是因为您在.NET Framework 4中运行基于.NET Framework 3.5的应用程序。您正在运行WebMatrix,要解决此问题,请转到“设置”节点以将.NET Framework版本设置为“.NET 2”。您还可以从web.config文件中删除多余的部分。

查看更多信息»


我已经调试了几个小时,无法更改此错误,更不用说修复它了。

我尝试使用几个不同版本的applicationHosts.config覆盖我的service-hosts.config文件,在64位运行IISExspress,用非常基本的版本替换web.config文件,在目录上设置权限(到我的电脑上的每个用户都可以访问),并更改应用程序池,但仍然没有变化。

奇怪的是......当我将WCF项目更改为在项目属性的Web部分中使用“IISExpress”,然后调试项目时,一切正常......即使我的所有web.config设置也是如此到位。

这指向我运行IISExpress或我的service-hosts.config文件的方式......虽然service-hosts.config文件(对所涉及的网站稍作修改)与我在我的文件中完全相同其他项目。

有一点需要注意(可能是红色鲱鱼),但我确实将解决方案从VS2012降级到VS2010,并将框架目标更改为.Net 4.0 ...不确定是否有什么东西可能配置为有趣?

有没有人有任何想法?我正跳到屋顶......

更新:

以下是IISExpress的调试信息(使用/ 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

这是我的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 />

1 个答案:

答案 0 :(得分:1)

似乎service-hosts.config文件指向了它本不应该指向的东西。我用旧项目的副本(因此是旧版本的IISExpress / .Net Framework)替换了我的service-hosts.config,一切正常。

听起来像是我的4.5 - &gt; 4.0毕竟降级。

相关问题