从asp.net获取WCF服务

时间:2015-06-07 06:12:17

标签: c# asp.net wcf

我在托管Windows中编写WCF服务和主机,并在App.config中添加以下代码

<add baseAddress="http://localhost:1200/000WCF/service"/>

但无法从网站上调用它,我添加 http://localhost:1200/000WCF/service 作为服务参考,但无法找到它

App.Config中:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="Microsoft.ServiceModel.Samples.CalculatorService"
               behaviorConfiguration="CalculatorServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:1200/000WCF/service"/>
          </baseAddresses>
        </host>
        <endpoint address="" binding="wsHttpBinding" contract="Microsoft.ServiceModel.Samples.ICalculator" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="CalculatorServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="False"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

0 个答案:

没有答案