我在.NET framework 4上开发了一个WCF服务。我的开发机器运行的是Windows 8,Visual Studio 2012,我已经在IIS 8上发布了该服务。
现在我需要在Windows XP计算机上发布该服务。我在IIS 5.1上遇到了多个错误,因此我放弃使用此版本,并试图将IIS Express 7.5与VS2010配合使用。
服务没有问题,但我无法访问WSDL,因为它说元数据已被禁用。
如何在我的WCF服务上激活元数据?
关注web.config:
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="SAP.Middleware.Connector">
<sectionGroup name="ClientSettings">
<section name="DestinationConfiguration" type="SAP.Middleware.Connector.RfcDestinationConfiguration, sapnco"/>
</sectionGroup>
</sectionGroup>
</configSections>
<SAP.Middleware.Connector>
<ClientSettings>
<DestinationConfiguration>
<destinations>
<add NAME="XXX" USER="XXX" PASSWD="XXX" CLIENT="XXX" LANG="EN" ASHOST="mc0.sap.XXX.com" SYSNR="XXX" MAX_POOL_SIZE="XXX" IDLE_TIMEOUT="XXX"/>
<add NAME="QA" USER="XXX" PASSWD="XXX" CLIENT="XXX" LANG="EN" ASHOST="XXX" SYSNR="XXX" MAX_POOL_SIZE="XXX" IDLE_TIMEOUT="100"/>
</destinations>
</DestinationConfiguration>
</ClientSettings>
</SAP.Middleware.Connector>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<appSettings/>
<system.web>
<compilation targetFramework="4.0" debug="true"/>
<httpRuntime/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
答案 0 :(得分:0)
您应该检查配置文件中是否启用了mex。
e.g。 (mex虽然http)。
在您的服务行为中,您应启用以下选项
<serviceMetadata httpGetEnabled="true" />
在您的端点列表中,您应添加以下内容
<endpoint address="/mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
保存您的配置并重新运行。
答案 1 :(得分:0)
我发现这个主题指示使用WEBMATRIX在IIS Express中托管WCF应用程序。它对我来说很完美。
希望它可以帮助其他人!
http://blogs.iis.net/vaidyg/archive/2010/07/29/serving-external-traffic-with-webmatrix-beta.aspx