开发者

WCF Configuration - basicHttpbinding

开发者 https://www.devze.com 2023-02-18 05:05 出处:网络
I have problem with basic configuration of WCF. I am working on MobilePhone Application . First I created test desktop appliction which use basicHttpBinding and everything was fine.

I have problem with basic configuration of WCF. I am working on MobilePhone Application . First I created test desktop appliction which use basicHttpBinding and everything was fine. Next I used the same code (Only difference is in ServerReference - In phone I used Two Server Files generated using NetCFSvcUtil). In Phone Application I am getting Endpoint no Found Exception. Below I am putting my configuration. I would be grateful for help or suggestions.

Regards.

Exception on Phone side:

There was no endpoint listening at http://localhost:4444/Service/PhoneService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

Phone Configuration:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>
   <bindings>
    <basicHttpBinding>
    <binding name="BasicHttpBinding" closeTimeout="00:01:00"
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
        maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLe开发者_C百科ngth="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
            realm="" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

  <client>
    <endpoint address="http://localhost:4444/Service/PhoneService/"
      binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding"
        contract="IPhoneService" name="BasicHttpBinding" />
    </client>



</system.serviceModel>

** revelant fragment of Server Configuration**

<service name="Server.PhoneService" behaviorConfiguration="Server.PhoneServiceBehavior">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="" contract="Server.IPhoneService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:4444/Service/PhoneService" />
      </baseAddresses>
    </host>
  </service>



//______________________________//

<behavior name="Server.PhoneServiceBehavior">
  <serviceMetadata httpGetEnabled="true" />
  <serviceDebug includeExceptionDetailInFaults="true" />
</behavior>

*Configuration in browser *

PhoneService Service

You have created a service.

To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:

svcutil.exe http://localhost:4444/Service/PhoneService?wsdl

This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:

C#

class Test
{
    static void Main()
    {
        PhoneServiceClient client = new PhoneServiceClient();

        // Use the 'client' variable to call operations on the service.

        // Always close the client.
        client.Close();
    }
}


The problem was caused by unavailable internet connection.

0

精彩评论

暂无评论...
验证码 换一张
取 消