0

我有一个在 .NET 框架 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>
4

2 回答 2

0

您应该检查您的配置文件中是否启用了 mex。

例如(通过 http 的墨西哥)。

在您的服务行为中,您应该启用以下选项

 <serviceMetadata httpGetEnabled="true" />

在您的端点列表中,您应该添加以下内容

<endpoint address="/mex" binding="mexHttpBinding" 
      contract="IMetadataExchange" />

保存配置并重新运行。

于 2013-01-15T14:42:58.693 回答
0

我发现这个主题指示使用 WEBMATRIX 在 IIS Express 中托管 WCF 应用程序。它对我来说非常有效。

希望它可以帮助别人!

http://blogs.iis.net/vaidyg/archive/2010/07/29/serving-external-traffic-with-webmatrix-beta.aspx

于 2013-01-15T16:31:46.573 回答