0

好吧,到目前为止,我只有一个端点和元数据端点。然后,我使用 Internet Explorer 为例,我可以看到元数据。

但是,当我为其他合同配置第二个端点时,我无法获取元数据,因此服务无法正确公开合同并且我无法使用来自客户端的服务。

我的 app.config(它是一个自托管服务)是:

<system.serviceModel>
    <services>

      <service name="GTS.CMMS.Service.Service" behaviorConfiguration="behaviorConfig">
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:7997/CMMSHost"/>
            <add baseAddress="http://localhost:7998/CMMSHost"/>
          </baseAddresses>
        </host>

        <endpoint address="ServiceCore/"
                  binding="netTcpBinding"
                  bindingConfiguration="ServiceCore"
                  name="ServiceCore"
                  contract="GTS.CMMS.Service.IService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>

        <endpoint address="ServiceDocumentos/"
                  binding="ServiceDocumentos"
                  bindingConfiguration="basicHttpBinding"
                  name="ServiceDocumentos"
                  contract="GTS.CMMS.Service.IServiceDocumentos">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>

        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="http://localhost:5000/mex" listenUriMode="Explicit" />
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="behaviorConfig">
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100" />
          <serviceMetadata/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <bindings>
      <netTcpBinding>
        <binding name="ServiceCore" maxBufferSize="67108864"
                      maxReceivedMessageSize="67108864" maxBufferPoolSize="67108864"
                       transferMode="Buffered" closeTimeout="00:00:10"
                       openTimeout="00:00:10" receiveTimeout="00:20:00"
                       sendTimeout="00:01:00" maxConnections="100"
                        portSharingEnabled="true">
          <security mode="None"/>
          <readerQuotas maxArrayLength="67108864" maxBytesPerRead="67108864" maxStringContentLength="67108864"/>
          <reliableSession enabled="true" inactivityTimeout="00:20:00" />
        </binding>

        <binding name="ServiceDocumentos" maxBufferSize="67108864"
                      maxReceivedMessageSize="67108864" maxBufferPoolSize="67108864"
                       transferMode="Streamed" closeTimeout="00:00:10"
                       openTimeout="00:00:10" receiveTimeout="00:20:00"
                       sendTimeout="00:01:00" maxConnections="100"
                      portSharingEnabled="true">
          <security mode="None"/>
          <readerQuotas maxArrayLength="67108864" maxBytesPerRead="67108864" maxStringContentLength="67108864"/>
          <reliableSession enabled="true" inactivityTimeout="00:20:00" />
        </binding>
      </netTcpBinding>

      <basicHttpBinding>
        <binding name="ServiceDocumentos" messageEncoding="Mtom" transferMode="Streamed"  />
        <binding name="ServiceCore" messageEncoding="Mtom" transferMode="Buffered" />
      </basicHttpBinding>

    </bindings>
  </system.serviceModel>

谢谢。

4

0 回答 0