没有端点侦听WCF服务错误

时间:2014-07-17 05:50:01

标签: .net wcf

这很奇怪:如果我的客户端应用程序以WCF服务的格式与

进行通信
http://xxxxx/servce.svc

它会显示如“没有端点听......”这样的错误。但是,如果我使用:

http://xxxxx/service.svc/svc

然后它有效!

-------------------- UPDATE -----------------

WCF服务是客户端应用程序项目中的“服务引用”。我说:

http://xxxxx/servce.svc

但是,当Visual Studio自动更改app.config文件时,我发现app.config中的URL变为:

http://xxxxx/service.svc/svc

还必须使用该格式来使客户端应用程序正常工作。 (它使用customBinding)

======================更新该WCF服务的Web.config ================= ====

<?xml version="1.0"?>
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="Test.Web.TestService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
    </sectionGroup>
    <section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor"/>       
  </configSections>

  <castle>
    <installers>
      <install assembly="Test.Web.Installers"/>
    </installers>
  </castle>
  <system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
    <bindings>
      <customBinding>
        <binding name="CustomBinaryBinding" sendTimeout="00:05:00" receiveTimeout="00:05:00">
          <binaryMessageEncoding maxSessionSize="2147483647">
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
          </binaryMessageEncoding>
          <httpTransport maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Buffered"/>
        </binding>
      </customBinding>
    </bindings>
    <services>
      <service name="Test.Web.TestService.WebService" behaviorConfiguration="TestServiceBehavior">
        <!--Include Http Get-->
        <endpoint address="" behaviorConfiguration="WebGetBehavior" binding="webHttpBinding" contract="Test.Web.TestService.IWebService"/>
        <endpoint contract="Test.Web.TestService.IWebService" binding="customBinding" bindingConfiguration="CustomBinaryBinding" address="svc" name="CustomBinaryBinding"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <!--Include Http Get-->
        <behavior name="WebGetBehavior">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>       
        <behavior name="TestServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>    
  </system.serviceModel>


  <system.web>
    <compilation debug="true" targetFramework="4.5"/>   
    <pages controlRenderingCompatibilityVersion="4.0"/>
  </system.web>
  <system.webServer>
    <defaultDocument>
      <files>
        <remove value="index.php"/>
        <remove value="default.aspx"/>
        <remove value="iisstart.htm"/>
        <remove value="index.html"/>
        <remove value="index.htm"/>
        <remove value="Default.asp"/>
        <remove value="Default.htm"/>
        <add value="SapphireService.svc"/>
      </files>
    </defaultDocument>
    <directoryBrowse enabled="true"/>
  </system.webServer>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Castle.Windsor" publicKeyToken="407dd0808d44fbdc" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-3.2.0.0" newVersion="3.2.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-3.2.0.0" newVersion="3.2.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

</configuration>

0 个答案:

没有答案