0

这是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到项目引用,甚至将其设置为复制本地。

结果,它只生成相同的 WSDL 文件,导入 XSD 等等:

...
<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 文件?

4

1 回答 1

0

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

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

  4. 现在在浏览器中点击你的网址到新的 .asmx?wsdl
  5. 繁荣。WSDL
于 2012-11-09T13:18:28.680 回答