我正在编写一个 WCF 服务,尝试在 .NET 4.0 中引入的无文件激活。我试图让服务返回 WSDL,虽然我以非常基本的方式配置了 web.config,但我无法让服务发出 WSDL。?wsdl 和 ?singlewsdl 只返回正常的服务页面而不是 WSDL。
我为此使用 .NET 4.5
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.serviceModel>
<services>
<service name="ods">
<endpoint address="localhost" binding="basicHttpBinding"
contract="co.ods" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"><!--aspNetCompatibilityEnabled="true"-->
<serviceActivations>
<add relativeAddress="ods.svc" service="co.ods" />
</serviceActivations>
</serviceHostingEnvironment>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
我认为配置存在问题,但我似乎找不到它。