简体   繁体   English

配置中 <service> WCF服务器web.config中的端点地址

[英]Configuring <service>endpoint address in WCF server web.config

I can't find what influence has configuration of <service> section endpoint address in web.config file. 我找不到在web.config文件中配置<service>endpoint address If I comment all available '' and start my WCF on ASP website project in Visual Studio, WCF Test Client utility starts and allows function call anyway like it did in uncommented case. 如果我注释所有可用的'',并在Visual Studio中的ASP网站项目上启动WCF,则WCF Test Client实用程序将启动并允许函数调用,就像在未注释的情况下一样。 And it is possible to go to standard page at http://localhost:35168/kmNNN.svc address in browser with information regarding WSDL and service usage samples like I did previously. 可以像浏览器中http://localhost:35168/kmNNN.svc ,通过浏览器中的http://localhost:35168/kmNNN.svc地址转到标准页面,其中包含有关WSDL和服务使用示例的信息。

How to test service is available at address defined in endpoint address ? 如何在endpoint address定义的endpoint address上测试服务是否可用?

How I can test that MEX service is started? 如何测试MEX服务已启动? I was thinking I can go to address http://localhost:35168/kmNNN.svc/MEX and see something in browser, but this doesn't work. 我以为可以转到地址http:// localhost:35168 / kmNNN.svc / MEX并在浏览器中看到某些内容,但这是行不通的。

web.config: 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>

Your config file not explicit. 您的配置文件不明确。 I think your service is kmNNNDevice declarec in kmNNNwebSrv namespace. 我认为您的服务是kmNNNwebSrv命名空间中的kmNNNDevice声明c。 hoep it helps take this one ep它有助于采取这一

<?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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM