Служба WCF для приложения Windows Mobile работает, но я не могу подключиться - PullRequest
2 голосов
/ 31 декабря 2011

Это моя первая попытка использовать WCF, а также мое первое приложение для Windows Mobile.Я следовал этому руководству: http://msdn.microsoft.com/en-us/library/cc488004(v=vs.90).aspx

Я создал службу WCF, появляется диалоговое окно узла службы WCF и говорится, что служба запущена без ошибок.Тем не менее, когда я пытаюсь перейти к нему через мой браузер, он не работает.Все, что я использую, находится на моей локальной машине под управлением Windows 7.

Я отключил все брандмауэры.

Я в недоумении, он говорит, что запущен, но я не могу перейти кЭто.При попытке получить сообщение http 400

Адрес метаданных: http://myip:8731/ElectricReadingCacheSyncService

Вот мой код конфигурации:

<system.serviceModel>
   <services>
      <service name="MiddleTierServiceLibrary.ElectricReadingCacheSyncService" behaviorConfiguration="MiddleTierServiceLibrary.ElectricReadingCacheSyncServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="http://MYIP:8731/ElectricReadingCacheSyncService/"   />
          </baseAddresses>
        </host>
        <endpoint 
            address=""  
            binding="basicHttpBinding"  
            contract="MiddleTierServiceLibrary.IElectricReadingCacheSyncContract">
          <identity>
            <dns value="MYIP"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
     </service>
   </services>
   <behaviors>
      <serviceBehaviors>
        <behavior name="MiddleTierServiceLibrary.ElectricReadingCacheSyncServiceBehavior">
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetai! lInFault s="True" />
        </behavior>
      </serviceBehaviors>
   </behaviors>
</system.serviceModel>

Любая помощь очень ценится!

РЕДАКТИРОВАТЬ: Здесь клиент конфигурации

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IElectricReadingCacheSyncContract"
                    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" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://MYIP:8731/ElectricReadingCacheSyncService/"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IElectricReadingCacheSyncContract"
                contract="IElectricReadingCacheSyncContract" name="BasicHttpBinding_IElectricReadingCacheSyncContract" />
        </client>
    </system.serviceModel>
</configuration> 

1 Ответ

0 голосов
/ 31 декабря 2011

Вы добавляете базовый адрес в конфигурацию:

... add baseAddress = "http://MYIP:8731/ElectricReadingCacheSyncService/"/>' ...

Для обмена данными вы добавляете "mex":

Мекс добавляется к вашему базовому адресу. В вашем браузере перейдите на:

http://MYIP:8731/ElectricReadingCacheSyncService/mex

и вы должны увидеть результаты.

...