0

我在我的计算机上托管了 WCF 服务(而不是在 IIS 上)。当我从 VS 2010 调用它时,此服务运行良好。但是如果我想从 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>

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

4

1 回答 1

1

You're using HttpBinding so some type of webserver is running on your box allowing the WCF hosting to work locally. So that's Cassini or IIS Express. Neither allows for remote connections without a bit of tweaking. Here's link of how to do that for IIS Express http://johan.driessen.se/posts/Accessing-an-IIS-Express-site-from-a-remote-comp‌​uter but it's a bit tedious though possible. I don't know if it's possible to allow Cassini to have remote connections.

于 2013-08-13T12:52:52.860 回答