【问题标题】:There was no endpoint listening at {0} that could accept the message. This is often cause by an incorrect address or SOAP action. (Xamarin Android)在 {0} 上没有可以接受消息的端点侦听。这通常是由不正确的地址或 SOAP 操作引起的。 (Xamarin 安卓)
【发布时间】:2016-05-04 08:23:43
【问题描述】:

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

我寻找了一个与此类似的解决方案,但我似乎无法弄清楚如何做到这一点,因为我使用的是 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>

【问题讨论】:

  • 我不认为你可以在你的模拟器或设备上使用 localhost 来访问你的服务。您可能需要使用您的机器 IP 或代理。
  • @Cheesebaron 我一直使用 localhost 运行它,它连接得很好,然后在我的 web 服务上编辑某些内容并在我的项目中重新添加元数据后突然发生此错误。
  • 我刚刚将 localhost http://localhost:51678/FSREmployee.svc 更改为我的 IP 地址,但仍然出现同样的错误。

标签: c# android wcf soap xamarin


【解决方案1】:

您使用的是哪个模拟器,可能是您的模拟器的问题。使用 genymotion emulator 运行流畅,没有任何问题。并且可以通过代理或 IP 访问托管在 localhost 上的服务。

【讨论】:

  • 我使用的是visual studio的内置模拟器。
  • 会不会是端口的原因?端口过期了吗?
  • 已经通过再次创建网络服务解决了。我怎样才能避免这种情况再次发生。
【解决方案2】:

已经通过再次创建网络服务解决了,现在它可以正常工作了。

【讨论】:

  • 我也有同样的问题。再次创建 Web 服务是什么意思?服务本身还是服务引用?我无法控制我需要调用的 SOAP 服务,但我可以在使用 WCF 的控制台应用程序中毫无问题地调用它,但使用 Xamarin Forms PCL 项目中完全相同的代码时会出现此错误。跨度>
猜你喜欢
  • 2010-12-14
  • 1970-01-01
  • 1970-01-01
  • 2021-01-28
  • 1970-01-01
  • 1970-01-01
  • 2021-08-29
  • 2016-03-25
相关资源
最近更新 更多