【问题标题】:Configuring <service>endpoint address in WCF server web.config在 WCF 服务器 web.config 中配置 <service> 端点地址
【发布时间】:2015-11-13 11:33:47
【问题描述】:

我在web.config 文件中找不到&lt;service&gt; 部分endpoint address 的配置有什么影响。如果我在 Visual Studio 中评论所有可用的 '' 并在 ASP 网站项目上启动我的 WCF,WCF 测试客户端实用程序将启动并允许函数调用,就像它在未注释的情况下所做的那样。并且可以像我之前所做的那样,在浏览器中访问http://localhost:35168/kmNNN.svc 地址的标准页面,其中包含有关 WSDL 和服务使用示例的信息。

如何测试endpoint address定义的地址是否可用?

如何测试 MEX 服务是否已启动?我在想我可以去地址http://localhost:35168/kmNNN.svc/MEX 并在浏览器中看到一些东西,但这不起作用。

web.config:

  <endpointBehaviors>
    <behavior name="kmNNNwebSrv.WCFJSproxyBehavior">
      <!--<enableWebScript/>-->
    </behavior>
  </endpointBehaviors>

  <serviceBehaviors>
    <behavior name="MEX">
      <serviceMetadata/>
    </behavior>

    <behavior name="">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
    multipleSiteBindingsEnabled="true" />

<services>

  <service name="kmNNNwebSrv.kmNNNDevice">
    <endpoint address="" 
              behaviorConfiguration="kmNNNwebSrv.WCFJSproxyBehavior"
              binding="basicHttpBinding" contract="kmNNNwebSrv.IkmNNNDevice">
    </endpoint>
  </service>

  <service name="MyService" behaviorConfiguration="MEX">
    <endpoint
        address="MEX"
        binding="mexHttpBinding"
        contract="IMetadataExchange"/>
  </service>


</services>

【问题讨论】:

    标签: c# asp.net .net web-services wcf


    【解决方案1】:

    您的配置文件不明确。我认为您的服务是 kmNNNwebSrv 命名空间中的 kmNNNDevice declarec 。希望它有帮助 拿这个

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections>
        <section  ...-Your Conf-...></section>
      </configSections>
    
      <connectionStrings>
         <add ....-Your connection string-.></add> 
      </connectionStrings>
    
      <applicationSettings>
      </applicationSettings>
    
      <system.serviceModel>
        <services>
    
          <service behaviorConfiguration="endpointBehavior" name="NamespaceOfYourService.YourService">
            <endpoint address="" binding="netTcpBinding" bindingConfiguration="netTcpBinding.NamespaceOfYourService" contract="NamespaceOfYourInterface.YourInterface">
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="net.tcp://localhost:port/YourService/" />
              </baseAddresses>
            </host>
          </service>
    
        </services>
    
        <behaviors>
          <serviceBehaviors>
            <behavior name="endpointBehavior">
              <serviceMetadata httpGetEnabled="false" />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <dataContractSerializer maxItemsInObjectGraph="2147483647" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
    
        <bindings>
          <netTcpBinding>
            <binding name="netTcpBinding.NamespaceOfYourService" transferMode="Streamed"
                     closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" 
                     maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" 
                            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    
            </binding>
    
          </netTcpBinding>
        </bindings>
    
      </system.serviceModel>
    </configuration>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-12-17
      • 2013-09-14
      • 1970-01-01
      • 2022-01-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多