none
Failed TO invoke the service RRS feed

  • Question

  • I am trying to invoke the weather service I have a very simple code but i got the following error 

    Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service.

    Server stack trace: 
       at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
       at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    code:

     public string[] w (string zipcode) {
     ServiceReference2.WeatherForecastSoapClient weather = new ServiceReference2.WeatherForecastSoapClient();
               WeatherForecasts re = weather.GetWeatherByZipCode(zipcode);
     string[] result = new string[5];
                return result;}

    ////////////IService1.cs
     [OperationContract]

           string[] w(string zipcode);

    //////////////web config
     <client>
          <endpoint address="http://www.webservicex.net/WeatherForecast.asmx"
            binding="basicHttpBinding" bindingConfiguration="WeatherForecastSoap"
            contract="ServiceReference2.WeatherForecastSoap" name="WeatherForecastSoap" />
          <endpoint address="http://www.webservicex.net/WeatherForecast.asmx"
            binding="customBinding" bindingConfiguration="WeatherForecastSoap12"
            contract="ServiceReference2.WeatherForecastSoap" name="WeatherForecastSoap12" />
        </client>




    • Edited by AdSaee Saturday, October 8, 2016 11:13 PM
    Saturday, October 8, 2016 11:09 PM

Answers

  • Hi AdSaee,

    Could you share us more information about your issue? Do you invoke weather service from your client or you create a WCF service to invoke weather service and then call WCF Service from your client?

    Based on your code, it seems you create a WCF service to invoke weather service. If so, could you share us your detailed steps? Your web config seems to have a wrong endpoint address. It should be your own service address. Your address seems to be weather service address. You could try Add Service reference with your own service address to generate the code and configuration.

    If you do not create your own WCF Service, I think you could try to add web service reference from your client. You could refer the link below for more information.

    # How to: Add a Reference to a Web Service

    https://msdn.microsoft.com/en-us/library/bb628649.aspx

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, October 10, 2016 5:48 AM

All replies

  • Can you also post the binding configuration?
    Monday, October 10, 2016 4:48 AM
  • Hi AdSaee,

    Could you share us more information about your issue? Do you invoke weather service from your client or you create a WCF service to invoke weather service and then call WCF Service from your client?

    Based on your code, it seems you create a WCF service to invoke weather service. If so, could you share us your detailed steps? Your web config seems to have a wrong endpoint address. It should be your own service address. Your address seems to be weather service address. You could try Add Service reference with your own service address to generate the code and configuration.

    If you do not create your own WCF Service, I think you could try to add web service reference from your client. You could refer the link below for more information.

    # How to: Add a Reference to a Web Service

    https://msdn.microsoft.com/en-us/library/bb628649.aspx

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, October 10, 2016 5:48 AM
  • Thank you for your replay;it help me to know my mistake.

    "If you do not create your own WCF Service, I think you could try to add web service reference from your client. You could refer the link below for more information".


    Wednesday, October 12, 2016 6:57 PM
  • Hi AdSaee,

    If your issue has been resolved, I would suggest you mark the helpful reply as answer. If not, please feel free to let us know, and we will try out best.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, October 13, 2016 1:33 AM