【问题标题】:wcfextras still generates many files instead of single WSDL filewcfextras 仍然生成许多文件而不是单个 WSDL 文件
【发布时间】:2012-11-08 03:08:20
【问题描述】:

这是我得到的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 文件?

【问题讨论】:

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


    【解决方案1】:

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

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

    4. 现在在浏览器中点击你的 URL 到新的 .asmx?wsdl
    5. 轰隆隆。 WSDL

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多