IIS托管WCF服务错误
问题描述:
我正在使用IIS 7.0托管一个简单的WCF服务。我使用VSTS 2008 + .Net 3.5 + C#编写它。问题是当我访问http://localhost:9999/service.svc(我想在web浏览器中我们可以浏览WSDL的内容,并创建一个使用9999端口并运行管理员帐户下的应用程序池的新网站),遇到以下错误,任何想法是什么错误?IIS托管WCF服务错误
http://i27.tinypic.com/a9r8cz.jpg
这里是我的service.svc:
<%@ ServiceHost Language="C#" Service="Gu.WCF.StudentManagement" %>
这里是我的web.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service behaviorConfiguration="Gu.WCF.ServiceBehavior"
name="Gu.WCF.StudentManagement">
<endpoint address="" binding="basicHttpBinding" contract="Gu.WCF.IStudentManagement">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Gu.WCF.ServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
答
听起来像.NET 3.0 ISAPI映射消失了。在.NET 3.0 WCF目录下(C:\ Windows \ Microsoft.NET \ Framework \ v3.0 \ Windows Communication Foundation)运行ServiceModelReg -r
答
请确保您有映射到.svc扩展名ISAPI处理程序。
谢谢,如果我需要从浏览器访问WSDL文件,我需要访问.svc文件? – George2 2009-07-25 05:42:49
是的,要获得WSDL,您需要点击该服务(访问.svc)文件,然后服务主机类将从其服务描述中组装WSDL。 – 2009-07-25 09:04:42