Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Calling webservice - Protocolexception - 404 RSS

38 replies

Last post Aug 11, 2008 06:54 PM by Tuizi

(0)
  • klukkluk

    klukkluk

    0 Points

    8 Posts

    Calling webservice - Protocolexception - 404

    Jun 22, 2008 11:34 PM | LINK

    I'm trying to access a webservice in my silverlight project. The webservice works fine, calling the webservice with different parameters gives me exactly the result I want, but with this set of parameters, I get a "ProtocolException was unhandled by user code" "The remote server returned an unexpected response (404) Not Found".

    Setting a breakpoint in the service, I see there's indeed nothing wrong with the service, the breakpoint gets hit, and the right response is returned. After googling a bit on the subject, a possible reson might be the length of the response. So I modified the web.config to include:

     <binding name="LargeBuffer" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
    <
    readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /></binding>

    And of course I set my bindingconfiguration to this. Still the same problem though. I tried using the web development helper to see what's going on, but this plugin throws a .NET exception:

     ************** Exception Text **************
    System.NullReferenceException: Object reference not set to an instance of an object.
       at nStuff.WebDevHelper.UserInterface.HttpTools.HttpLogConsole.ProcessNewItems()

    So no help there either. Does anyone have any suggestions left about what's wrong here?

     

  • sladapter

    sladapter

    All-Star

    43609 Points

    7910 Posts

    Re: Calling webservice - Protocolexception - 404

    Jun 23, 2008 01:43 AM | LINK

    1) Are you doing cross-domain call? If yes, have you updated your clientaccesspolicy file?

    2) If you do not think it is cross-domain call. Have you checked url for the endpoint of your service in your ServiceReference.ClientConfig file? Is the Port# in that url the same as the port# in your page url? Or you set the Service URL in your code?

    3) Did you get the error only when you trying to send large data back to your WebService? If not, your LargeBuffer binding change won't help you. If yes, take a look at this thread. Follow the steps I posted in my last post there to config your Web.config and ServiceReference.ClientConfig file:

    http://silverlight.net/forums/p/18466/63010.aspx#63010

     

     

     

    Sally Xu
    Software Engineer
    Aprimo, Inc

    Please remember to mark the replies as answers if they answered your question
  • klukkluk

    klukkluk

    0 Points

    8 Posts

    Re: Calling webservice - Protocolexception - 404

    Jun 23, 2008 09:31 AM | LINK

    Still no luck, the 2nd time my webservice gets called, it still fails. It's no cross-domain call, and it's no port problem, because in that case the first call would have failed as well. I've modified the ClientConfig like you suggested, but still the same problem :(

  • SteveWong

    SteveWong

    Contributor

    6769 Points

    1351 Posts

    Re: Re: Calling webservice - Protocolexception - 404

    Jun 23, 2008 12:20 PM | LINK

     can you paste your clientaccesspolicy.xml and the web.config and ServiceReference.ClientConfig here?

    Regards,
    SteveWong (HongKong)
    Please mark post as answer if they help you
  • sladapter

    sladapter

    All-Star

    43609 Points

    7910 Posts

    Re: Calling webservice - Protocolexception - 404

    Jun 23, 2008 01:11 PM | LINK

    klukkluk

    Still no luck, the 2nd time my webservice gets called, it still fails. It's no cross-domain call, and it's no port problem, because in that case the first call would have failed as well. I've modified the ClientConfig like you suggested, but still the same problem :(



    What do you mean by "the 2nd time my webservice gets called"? So you have it working, but only on every first try? If you can ever get it working, then it is not cross-domain issue nor is configuration issue. Are every time you calling the same method and passing the same data?

     

     

    Sally Xu
    Software Engineer
    Aprimo, Inc

    Please remember to mark the replies as answers if they answered your question
  • lewisb

    lewisb

    Member

    217 Points

    82 Posts

    Re: Calling webservice - Protocolexception - 404

    Jun 23, 2008 03:58 PM | LINK

    Is the first call to the webservice passing/returning a some primative data type(s) and the second call using some complex data type?  If so, there may be some sort of serialization error.

  • klukkluk

    klukkluk

    0 Points

    8 Posts

    Re: Calling webservice - Protocolexception - 404

    Jun 23, 2008 05:26 PM | LINK

    @SteveWong:

     I don't have a clientaccesspolicy file, this is my clientconfig:

     <configuration>
    <
    system.serviceModel>
    <
    client>
    <
    endpoint address="http://localhost:58139/MasterDetail.svc" binding="basicHttpBinding"
    bindingConfiguration="BasicHttpBinding_MasterDetail" contract="SLWeb.ServiceReference.MasterDetail"
    name="BasicHttpBinding_MasterDetail" />
    </
    client>
    <
    bindings>
    <
    basicHttpBinding>
    <
    binding name="BasicHttpBinding_MasterDetail" maxBufferSize="2147483647"
    maxReceivedMessageSize="2147483647">
    <
    security mode="None" />
    </
    binding>
    </
    basicHttpBinding>
    </
    bindings>
    </
    system.serviceModel>
    </
    configuration>

     @sladapter:

    Yes, I have the webservice working, but only with a certain set of 'request' parameters. With a 2nd set, a different response is returned. And this one fails.

  • sladapter

    sladapter

    All-Star

    43609 Points

    7910 Posts

    Re: Calling webservice - Protocolexception - 404

    Jun 23, 2008 06:16 PM | LINK

    klukkluk

    Yes, I have the webservice working, but only with a certain set of 'request' parameters. With a 2nd set, a different response is returned. And this one fails.

     

    What is your second set of parameter that not working? Could you show your the WebService function signature?

     

     

    Sally Xu
    Software Engineer
    Aprimo, Inc

    Please remember to mark the replies as answers if they answered your question
  • lewisb

    lewisb

    Member

    217 Points

    82 Posts

    Re: Calling webservice - Protocolexception - 404

    Jun 23, 2008 06:21 PM | LINK

    Also, what are the return types of both calls?  Bool, int, some complex object?

  • klukkluk

    klukkluk

    0 Points

    8 Posts

    Re: Calling webservice - Protocolexception - 404

    Jun 23, 2008 07:08 PM | LINK

    The return type of my webmethod is a complex type.