Restful WCF 4.0 上的 IIS 7.5 错误
我一直在尝试做一个简单的restful wcf 服务,它将返回JSON。如果我在开发服务器中运行它,它就可以工作。但是,如果我将其部署在 IIS 7.5 上,当我使用 http://localhost:70< 访问它时,将会出现此错误/a>
HTTP 错误 500.19 - 内部服务器 错误 请求的页面无法 访问是因为相关 该页面的配置数据是 无效。
配置错误配置部分 无法读取“standardEndpoints” 因为它缺少一个部分 声明
这是我的配置文件: 这是VS2010生成的默认文件。
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<standardEndpoints>
<webHttpEndpoint>
<!--
Configure the WCF REST service base address via the global.asax.cs file and the default endpoint
via the attributes on the <standardEndpoint> element below
-->
<standardEndpoint name="LocationService" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
</configuration>
我是 WCF 新手,特别是 .net 4.0 和 IIS 7.5。
有人可以帮忙吗?或者有人经历过同样的事情并且已经解决了?
I've been trying to do a simple restful wcf service that will return JSON. Its working if i will run it in the development server. However if I deploy it on IIS 7.5, i will have this error when i accessed it using http://localhost:70
HTTP Error 500.19 - Internal Server
Error The requested page cannot be
accessed because the related
configuration data for the page is
invalid.Config Error The configuration section
'standardEndpoints' cannot be read
because it is missing a section
declaration
Here is my configuration file: This is the default file generated by the VS2010.
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<standardEndpoints>
<webHttpEndpoint>
<!--
Configure the WCF REST service base address via the global.asax.cs file and the default endpoint
via the attributes on the <standardEndpoint> element below
-->
<standardEndpoint name="LocationService" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
</configuration>
Im new to WCF specially on .net 4.0 and IIS 7.5.
Can anybody help? Or anybody has experienced the same and has fixed already?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您是否确实将站点的 IIS 应用程序池配置为与 ASP .NET 4.0 一起运行?
在 IIS 管理器中右键单击您的虚拟目录 >管理应用程序>高级设置>读取应用程序池名称。
然后转到应用程序池,找到该名称并确保 .NET Framework 列显示 v4.0。
Do you definitely have the IIS application pool for your site configured to run with ASP .NET 4.0?
Right click your Virtual Directory in IIS Manager > Manage Application > Advanced Settings > read the app pool name.
Then go to Application Pools, find that name and make sure the .NET Framework column says v4.0.
我在运行 .net 4.0 的应用程序池的 w2008 x64 上遇到了同样的错误;安装SP2后问题消失
I had the same error on a w2008 x64 with the app pool running .net 4.0; after installing SP2 the issue disappeared
在未安装 Service Pack 2 的 Windows Server 2008 上会出现此问题。要解决此问题,请安装 Windows Server 2008 Service Pack 2。
取自 Ram Poornalingam 2009 年 10 月 26 日的 WebLog 条目:
This issue can be seen on Windows Server 2008 without service pack 2 installed. To fix the problem install Windows Server 2008 Service Pack 2.
Taken from Ram Poornalingam's WebLog entry from the 26th October 2009:
很抱歉问一个对某些人来说似乎显而易见的问题,但如果您能澄清最后一步,它可能会帮助其他人(主要是我):
然后转到应用程序池...
在哪里可以找到应用程序池?
如果你看不出我习惯在大公司工作,其他人为我做这件事,而现在我扮演开发人员和 IT 总监。
谢谢
好的,经过 10 秒的研究(我睁开眼睛),查看了 IIS 管理器中站点的正上方
Sorry to ask a question that may seem obvious to some, but it might help others (mainly me) if you could clarify the last step:
Then go to Application Pools...
Where do I find Application Pools ?
If you can't tell I am used to working for big companies where someone else did that for me and now I am playing developer and IT director.
Thanks
Ok, after 10 seconds of research (I opened my eyes) and looked right above Sites in IIS Manager