在{0}没有可以接受该消息的端点。这通常是由不正确的地址或SOAP操作引起的。 (Xamarin Android)

时间:2016-05-04 08:23:43

标签: c# android wcf soap xamarin

我通常可以在模拟器上运行应用程序并在之前执行某些操作,但出于某种原因,即使Web服务在浏览器上正常运行,这也会突然出现。

error

我找到了一个类似案例的解决方案,但我似乎无法弄清楚如何做到这一点,因为我使用的Xamarin有一种不同的方式来添加服务引用。

以下是我的代码:

ServiceReferences.ClientConfig

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IFSREmployee" maxBufferSize="2147483647"
                    maxReceivedMessageSize="2147483647">
                    <security mode="None" />
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:51678/FSREmployee.svc" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IFSREmployee" contract="IFSREmployee"
                name="BasicHttpBinding_IFSREmployee" />
        </client>
        <extensions />
    </system.serviceModel>
</configuration>

的Web.config

<?xml version="1.0"?>
<configuration>

  <connectionStrings>
    <add name="SQL_HCMConnectionString" connectionString="Data Source=ADGTAPPS5;Initial Catalog=SQL_HCM;User ID=hcm;Encrypt=False;TrustServerCertificate=True"
      providerName="System.Data.SqlClient" />
    <add name="OFFICEConnectionString" connectionString="Data Source=ADGTAPPS5;Initial Catalog=OFFICE;User ID=office;Encrypt=False;TrustServerCertificate=True"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
    <httpModules>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"/>
    </httpModules>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <!-- 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>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https"/>
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="ApplicationInsightsWebTracking"/>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
        preCondition="managedHandler"/>
    </modules>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
    <validation validateIntegratedModeConfiguration="false"/>
  </system.webServer>

</configuration>

2 个答案:

答案 0 :(得分:0)

您使用的是哪个模拟器可能是您的模拟器的问题。使用genymotion模拟器它的工作顺利,没有任何问题。并且可以通过代理或IP来访问localhost上托管的服务。

答案 1 :(得分:-1)

已经通过再次创建Web服务解决了,现在它正常运行。