无法进入WCF服务应用程序

时间:2014-03-11 20:51:57

标签: .net wcf

我正在尝试从我的客户端应用程序向我的WCF服务发送消息,但我无法进入服务操作以进行调试。

我使用安装程序在另一个项目中托管服务,服务启动完美。我可以在运行主机应用程序后访问服务URL。

我有一个具有此配置的服务应用程序:

    system.serviceModel>
        <client/>
        <behaviors>
          <serviceBehaviors>
            <behavior name="meta">
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <services>
            <service behaviorConfiguration="meta" name="InboundMessage.Service.Operator">
            <endpoint address="" binding="basicHttpBinding" contract="InboundMessage.Service.IOperator"/>
            <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
            <host>
              <baseAddresses>
                <add baseAddress = "http://localhost/InboundMessage.Service/" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <bindings>
          <basicHttpBinding>
            <binding name="UNI.Endpoint.Basic"/>
          </basicHttpBinding>
        </bindings>

      </system.serviceModel>

服务运营:

      IOperation
      [ServiceContract(Namespace = "http://xx/MessageService/", SessionMode = SessionMode.Allowed)]
    public interface IOperator
    {
    [OperationContract(Action = "http://xx/MessageService/GetMessage")]
     byte GetMessage(string AppId, string Message);

}


   [ServiceBehavior(Namespace = "http://xx/MessageService/",    IncludeExceptionDetailInFaults = true)]
      public class Operator : IOperator
       {
    public byte GetMessage(string AppId, string Message)
    { //
    // returns byte 
}

我的客户端是一个webform,它具有以下配置:

   <system.serviceModel>
    <services>
    <service behaviorConfiguration="InboundMessage.Service.IOperator" name="InboundMessage.Service.Operator">
      <endpoint address="" binding="wsHttpBinding" contract="InboundMessage.Service.IOperator" bindingConfiguration="largeMessageHttpBinding">
        <identity>
          <dns value="localhost"/>
        </identity>
      </endpoint>
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      <host>
        <baseAddresses>
          <add baseAddress="http://localhost/InboundMessage.Service/"/>
        </baseAddresses>
      </host>
    </service>
  </services>

    <bindings>
         <wsHttpBinding>
        <binding name="largeMessageHttpBinding" maxReceivedMessageSize="10485760">
          <readerQuotas maxArrayLength="100000"/>
        </binding>
      </wsHttpBinding>
    </bindings>

  <behaviors>
    <serviceBehaviors>
      <behavior name="InboundMessage.Service.IOperator">
        <serviceMetadata httpGetEnabled="true"/>
        <serviceDebug includeExceptionDetailInFaults="false"/>
      </behavior>
      <behavior name="SessionServiceBehavior">
        <serviceMetadata httpGetEnabled="True"/>
        <serviceDebug includeExceptionDetailInFaults="True"/>
      </behavior>
    </serviceBehaviors>
  </behaviors>
我错过了什么?谢谢

1 个答案:

答案 0 :(得分:0)

初步观察:

  • 您的服务配置了basicHttpBinding,但您的客户端配置了wsHttpBinding。

需要更多信息:

  • 您的客户是否能够从服务中获得正确的响应,或者您是否获得例外?
  • 当您说“我正在使用安装程序在另一个项目中托管服务”时,“安装程序”是什么意思?
  • 您的服务是托管在Cassini,IIS Express还是IIS?
相关问题