5

I have a piece of code in which there are 2 sequential calls to a good old ASMX web service.

service.Url = "http://.....";
service.A(1, 2, 3);
service.B(4, 5, 6);

Call to A is fine. But call to B throws 404... not found... In discovery, both methods are visible and seem fine - I see both in IE, metadata looks good. I placed break point in B and it is definitely not hitting. I did rebuild, Update Web Service reference in consuming project and rebuilt it.

The status is WebExceptionStatus.ProtocolError.

Signature of failing web Method

<WebMethod(Description:="Store a fragment of object on server.")> _
Public Function B(
    ByVal p1 As String, 
    ByVal p2 As String,
    ByVal p3() As Byte, 
    ByVal p4 As Integer,
    ByVal p5() As Byte) As Boolean

The call is (verified)

bool result = service.B(string, string, byteArray1, int, byteArray2);

Again, WebMethod B is not reached. Web reference proxy and all - look good. What can it be?

15
  • You probably have wrong url for your service try setting url of service to correct url lik service.Url = "http://<hostName>/directory/service1.asmx";
    – Adil
    Aug 13, 2015 at 4:12
  • @Adil This is what exactly done. Ulr is set before calls to A and B
    – T.S.
    Aug 13, 2015 at 4:13
  • Copy that url and browse, if it is fine then rebuild your service, update reference and rebuild the consuming application
    – Adil
    Aug 13, 2015 at 4:15
  • @Turbulence What exactly do you need? - Clearly, same url, same code base, 2 methods, one doesn't respond (not found) programmatically but is there when you place this URL into IE address bar and looks good there
    – T.S.
    Aug 13, 2015 at 4:16
  • @Adil done all that. This is why I ask the question. Could be environmental. Or, may be someone knows something, like, how to identify this issue smartly
    – T.S.
    Aug 13, 2015 at 4:18

1 Answer 1

5

I resolved it. It was confusing since I was getting HTTP/1.1 404 Not Found and WebExceptionStatus.ProtocolError.

Once I hooked-up Fiddler2, I was digging in it and found WebView, in which it clearly says:

•Request filtering is configured on the Web server to deny the request because the content length exceeds the configured value.

To resolve the issue I've changed configuration in IIS to allow 50MB requests.

Edit request propertues

And you also want to have following setting in web.config

<httpRuntime maxRequestLength="1000000" executionTimeout="3000"/>

Max setting is 2097151 KB

404 was confusing. It sounded like issue with web service while in reality it was the size of request. And when I said it worked before, it is simply because before I wouldn't save such large objects as I have to this time.

2
  • Extremely horrible to know that size of the request was causing HTTP 404 error. Simply a nightmare experience. I was also uploading a file as byte array in the web method argument which was exceeding the configured size in IIS. Thanks for helping us out.
    – RBT
    Feb 23, 2018 at 7:09
  • @RBT Could be just Microsoft's way to obscure things a little. If you a real client, you may know that you can only upload file up to specific size. But if you are some hacker and just probing things, you get 404 and "ah, can't do this". Who knows?
    – T.S.
    Feb 23, 2018 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.