【问题标题】:There was no endpoint listening at https://... that could accept the message. This is often caused by an incorrect address or SOAP action在 https://... 上没有可以接受消息的端点监听。这通常是由不正确的地址或 SOAP 操作引起的
【发布时间】:2017-01-24 14:26:44
【问题描述】:

我正在使用第 3 方网络服务,我可以从浏览器查看和运行它没有问题

我已将服务引用添加到 Visual Studio 并指定了名称页:

因为它是一个网络应用程序,所以我将相关位从 app.config 复制到 web.config

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="MembersSoap">
          <security mode="Transport"> 
            <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> 
            <message clientCredentialType="Certificate" algorithmSuite="Default" />
         </security>
         </binding>
        <binding name="BookingsSoap">
          <security mode="Transport"> 
            <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> 
            <message clientCredentialType="Certificate" algorithmSuite="Default" />
         </security>
         </binding> 

      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://server/directory/Members.asmx" binding="basicHttpBinding" bindingConfiguration="MembersSoap" contract="MWSMembers.MembersSoap" name="MembersSoap" />
      <endpoint address="https://server/directory/Bookings.asmx" binding="basicHttpBinding" bindingConfiguration="BookingsSoap" contract="MWSBookings.BookingsSoap" name="BookingsSoap" />

   </client>
  </system.serviceModel>

这是我使用 MWSBookings 网络服务的方法:

private string GetBookings()
{
    using (MWSBookings.BookingsSoapClient client = new MWSBookings.BookingsSoapClient())
    {
        try
        {

            var bookings = client.ListBookableActivitiesClassesCourses(GetMemberAuthHeader2(), 0123456, "5", false);
            return bookings.ToString();

        }
        catch (Exception ex)
        {
            return ex.Message.ToString();
        }
    }


}

当我构建我的解决方案并查看浏览器页面时,我收到以下错误:

https://server/directory/Bookings.asmx 上没有可以接受消息的端点监听。这通常是由不正确的地址或 SOAP 操作引起的。有关详细信息,请参阅 InnerException(如果存在)。

我已经搜索了 Stack Overflow 上的所有其他帖子,但没有一个解决方案对我的情况有所帮助。我已确保安装了 HTTP 激活功能,我尝试将 AppPool 从 appPoolIdentity 运行到 NetworkService,但没有帮助。还尝试在 web.config 中包含 maxRequestLength 和 maxAllowedContentLength 并增加限制但没有区别。

如果有人能提供任何建议,我将不胜感激。

谢谢 斯科特

更新 以下是完整的异常消息:

        System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at https://server/directory/Bookings.asmx 
that could accept the message. This is often caused by an incorrect address or SOAP action. 

See InnerException, if present, for more details. --->

System.Net.WebException: Unable to connect to the remote server ---> 
System.Net.Sockets.SocketException: A connection attempt failed because the 
connected party did not properly respond after a period of time, or 
established connection failed because connected host has failed to respond 
MYIP:443 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, 
SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket 
s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, 
IAsyncResult asyncResult, Exception& exception) --- End of inner exception 
stack trace --- at 
    System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at 
System.Net.HttpWebRequest.GetRequestStream() at 
    System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream(
) --- End of inner exception stack trace --- Server stack trace: at 
    System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream(
) at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout) at 
    System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChan
nelRequest.SendRequest(Message message, TimeSpan timeout) at 
    System.ServiceModel.Channels.RequestChannel.Request(Message message, 
TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String 
action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, 
Object[] outs, TimeSpan timeout) at 
    System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMes
sage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 
Exception rethrown at [0]: at 
    System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage 
reqMsg, IMessage retMsg) at 
    System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& 
msgData, Int32 type) at 
    MySolution.MWSBookings.BookingsSoap.ListBookableActivitiesClassesCourses(List
BookableActivitiesClassesCoursesRequest request) at 
    MySolution.MWSBookings.BookingsSoapClient.MySolution.MWSBookings.BookingsSoap
.ListBookableActivitiesClassesCourses(ListBookableActivitiesClassesCoursesReq
uest request) in D:\website\branches\csharp\Service References\MWSBookings
\Reference.cs:line 4464 at MySolution.MWSBookings.BookingsSoapClient.ListBookableActivitiesClassesCourses(AuthHeader AuthHeader, Int32 memberId, String siteId, Boolean webBookableOnly) in D:\website\branches\csharp\Service References\MWSBookings\Reference.cs:line 4473 at MySolution.ActivityFinder.GetBookings() in D:\website\branches\csharp\Service References\Classes\MyClass.cs:line 97 

【问题讨论】:

  • 1,您是否必须安装任何身份验证证书才能连接到该站点(当您启动网络浏览器时,它是否要求您选择证书)? 2. 是否有任何身份验证(登录/密码)? 3. 在您的 Catch 块中,您应该更改它:如果有 InnerException,则返回该消息,否则,返回 Exception 消息。
  • 可能是防火墙阻止了您的应用?确保您在管理权限下运行它
  • @tgolisch 嗨,我想我可能因为代理服务器而遇到问题,如果我的流量需要通过代理服务器,我应该在 web.config 中使用什么正确设置?我试过 没有运气
  • @komsky 嗨 Komsky,我不认为这是防火墙问题,我在上面发布了一些进一步的异常消息,它表明这是代理问题。知道如何添加代理凭据以允许应用通过吗?

标签: c# asp.net web-services wcf


【解决方案1】:

问题出在代理服务器上,我在调用我的网络服务之前添加了以下几行,并且错误消息现在已经消失了。

var proxy = new WebProxy("myproxy:8080", true);

proxy.Credentials = new NetworkCredential("username", "password");

WebRequest.DefaultWebProxy = proxy;

【讨论】:

    猜你喜欢
    • 2010-12-14
    • 1970-01-01
    • 1970-01-01
    • 2021-01-28
    • 1970-01-01
    • 2023-03-18
    • 1970-01-01
    • 2011-04-24
    相关资源
    最近更新 更多