在开发WCF服务或网站解决方案时,我总是将IISExpress与自定义配置文件一起使用,以便与团队中的其他开发人员共享设置。基本上,我运行一个批处理文件,其中包含以下命令:
"C:\Program (x86)\IIS Express\iisexpress.exe“/config:service-hosts.config
其中service-hosts.config是我的自定义配置文件的路径。
这个方法一直工作得很好,并且在我的PC上的其他解决方案中仍然很好(每个解决方案都有自己的服务-hosts.config文件)。但是,我刚刚开始使用这种方法加载WCF服务时遇到了问题。当我试图浏览到服务根dir或任何内置的帮助端点时,我会得到以下错误:
HTTP错误500.19 -内部服务器错误请求页无法访问,因为该页的相关配置数据无效。
详细错误信息:
模块IIS Web核
通知未知
处理程序尚未确定
错误代码0x80070003
配置错误无法读取配置文件
配置文件\?\D:\Projects\MyProject\WCFSite\web.config
请求网址http:// localhost:80/
物理路径
登录方法尚未确定
登录用户尚未确定
请求跟踪目录C:\Users\Spikeh\Documents\IISExpress\TraceLogFiles\
配置源:
-1:
0: 更多资料:
当读取Web服务器或Web应用程序的配置文件时出现此错误。在某些情况下,事件日志可能包含有关导致此错误的更多信息。
如果您看到文本“有一个重复的'system.web.extensions/scripting/scriptResourceHandler‘部分定义了”,这个错误是因为您在.NET Framework4中运行一个基于.NET Framework3.5的应用程序。如果您正在运行WebMatrix,要解决这个问题,请转到设置节点将.NET框架版本设置为".NET 2“。您还可以从web.config文件中删除额外的部分。
查看更多信息
我已经调试了几个小时了,无法更改此错误,更不用说修复它了。
我尝试过用几个不同版本的applicationHosts.config覆盖我的服务-hosts.config文件,以64位运行IISExspress,用一个非常基本的版本替换web.config文件,设置目录上的权限(我的PC上的每个用户都可以访问),并更改应用程序池,但仍然没有改变。
奇怪的是..。当我将WCF项目更改为在项目属性的Web部分中使用"IISExpress“时,然后随后调试该项目,一切都正常.即使我的所有web.config设置就位。
这说明了我是如何运行IISExpress的,或者是服务-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下面是我的服务的重要部分-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 />
发布于 2013-02-25 08:28:46
似乎service-hosts.config文件指向了它不应该指向的东西。我将服务-hosts.config替换为来自旧项目的副本(因此是IISExpress / .Net框架的旧版本),一切都正常。
听起来这跟我的4.5 -> 4.0降级有关。
https://stackoverflow.com/questions/15027172
复制相似问题