在移动设备上没有端点监听,但在控制台应用程序上工作正常

时间:2013-08-13 12:23:12

标签: c# wcf service windows-mobile

我的计算机上安装了WCF服务(不在IIS上)。当我从VS 2010中称它为funnction时,这项服务工作正常。但如果我想从Windows Mobile设备调用某些方法,我会收到以下错误:没有端点正在监听.... 我的服务配置是:

    <?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="DataSource" value="CMP\DATABASE" />
    <add key="DataName" value="DAT" />
  </appSettings>
  <system.web>
    <compilation debug="true"/>
  </system.web>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <bindings>
      <mexHttpBinding>
        <binding name="MexBinding"/>
      </mexHttpBinding>
      <basicHttpBinding>
        <binding name="Binding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
          <!-- UsernameToken over Transport Security -->
          <!--<security mode="Transport">
            <message clientCredentialType="Certificate" />
          </security>-->
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="Test.Service" behaviorConfiguration="Test.ServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="http://10.0.0.2:1918/Myservice/Service/"/>
          </baseAddresses>
        </host>
        <!-- Service Endpoints -->
        <!-- Unless fully qualified, address is relative to base address supplied above -->
        <!--<endpoint address="" binding="wsHttpBinding" contract="WcfServiceLibrary.IService">
          -->
        <!-- 
              Upon deployment, the following identity element should be removed or replaced to reflect the 
              identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
              automatically.
          -->
        <!--
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>-->
        <!-- Metadata Endpoints -->
        <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
        <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>

        <endpoint address="ServiceA" binding="basicHttpBinding" bindingConfiguration="Binding" name="Service" bindingName="Binding" contract="Test.IService"/>
      </service>
    </services>
    <!--<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>-->
    <behaviors>
      <serviceBehaviors>
        <behavior name="Test.ServiceBehavior">
          <!-- To avoid disclosing metadata information, 
          set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <!--<serviceAuthorization principalPermissionMode="None" />-->
          <!-- To receive exception details in faults for debugging purposes, 
          set the value below to true.  Set to false before deployment 
          to avoid disclosing exception information -->
          <!--<serviceDebug includeExceptionDetailInFaults="False" />-->
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

我的移动设备上没有设置代理。

1 个答案:

答案 0 :(得分:1)

您正在使用HttpBinding,因此您的盒子上运行了某种类型的Web服务器,允许WCF托管在本地工作。这就是Cassini或IIS Express。没有一点调整就不允许远程连接。这里是IIS Express http://johan.driessen.se/posts/Accessing-an-IIS-Express-site-from-a-remote-comp如何做到这一点的链接,但尽管可能有点单调乏味。我不知道是否可以允许Cassini进行远程连接。