wcfextras仍然生成许多文件而不是单个WSDL文件

时间:2012-11-08 03:08:20

标签: c# .net wcf wsdl wcf-extensions

这是我得到的app.config

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <extensions>
      <behaviorExtensions>
        <add name="wsdlExtensions" type="WCFExtras.Wsdl.WsdlExtensionsConfig, WCFExtras, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
      </behaviorExtensions>
    </extensions>

    <behaviors>
      <endpointBehaviors>
        <behavior name="WsdlSampleEndpointBehavior">
          <wsdlExtensions singleFile="true" />
        </behavior>
      </endpointBehaviors>

      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="True"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <diagnostics>
      <messageLogging
           logEntireMessage="true"
           logMalformedMessages="true"
           logMessagesAtServiceLevel="true"
           logMessagesAtTransportLevel="true"
           maxMessagesToLog="3000"
           maxSizeOfMessageToLog="20000"/>
    </diagnostics>
<services>
  <service name="VogService">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8733/"/>
      </baseAddresses>
    </host>
    <endpoint address="GoToTheMarketService"
    binding="basicHttpBinding" bindingConfiguration="GoToTheMarketService"
    contract="GoToTheMarketService" name="GoToTheMarketService" behaviorConfiguration="WsdlSampleEndpointBehavior">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>
</services>

<bindings>
  <basicHttpBinding>
    <binding name="GoToTheMarketService" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="Transport">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </system.serviceModel>

  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel.MessageLogging">
        <listeners>
          <add name="messages"
          type="System.Diagnostics.XmlWriterTraceListener"
          initializeData="C:\messages.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

我将wcfextras添加到项目引用中,甚至将其设置为复制本地。

在结果中它只生成导入XSD的相同WSDL文件,依此类推:

...
<wsdl:import namespace="aaa" location="http://localhost:8733/?wsdl=wsdl0"/>
...
<xsd:schema targetNamespace="aaa/Imports">
<xsd:import schemaLocation="http://localhost:8733/?xsd=xsd0" namespace="aaa"/>
<xsd:import schemaLocation="http://localhost:8733/?xsd=xsd1" namespace="http://lalala.com/asdas12"/>
</xsd:schema>
...

如何才能生成一个单一的WSDL文件?

1 个答案:

答案 0 :(得分:0)

要获得传统的WSDL,我们使用以下步骤:

  1. 在您的svc.vb中,导入System.Web.Services
  2. 在.svc.vb中,使用<WebMethod()>
  3. 标记每个公开的方法
  4. 添加.asmx文件(与.svc相同的目录) .asmx中的代码:

  5. 现在在浏览器中将您的网址命中为新的.asmx?wsdl
  6. 动臂。 WSDL