Michael Rut
Michael Rut

Reputation: 1027

WCF/IIS 400 Error

I am getting a 400 error running my WCF service (.NET 3.5) in IIS7 with the following URL:

http://localhost/mrlabatch/MRLABatchProcessingService.svc/events/sr123%20eb/ACCESSCONTROL,ADT,ADTDERIVATION,ADTSTATIONNUMBER,ADTYEAR,CITY,COUNTY,FACILITYTYPE,FEDERALAIDROUTENUMBER,FUNCTIONALCLASSIFICATION,JURISDICTION,LEFTSHOULDERTYPE,LEFTSHOULDERWIDTH,LEFTSIDEWALKWIDTH,MASSDOTHIGHWAYDISTRICT,MEDIANTYPE,MEDIANWIDTH,MPO,NHSSTATUS,NUMBEROFPEAKHOURLANES,NUMBEROFTRAVELLANES,RIGHTOFWAYWIDTH,RIGHTSHOULDERTYPE,RIGHTSHOULDERWIDTH,RIGHTSIDEWALKWIDTH,ROUTEKEY,SPEEDLIMIT,STREETNAME,STREETOPERATION,SUBROUTE,SURFACETYPE,SURFACEWIDTH,TERRAIN,TRUCKROUTE,UNDIVIDEDLEFTSHOULDERTYPE,UNDIVIDEDLEFTSHOULDERWIDTH,URBANIZEDAREA,URBANTYPE/?frommp=8.28489&tomp=10.30031

The url will work fine in when debugging in Visual Studio (specifying a different port of course)

If I shorten the URL it works fine as well in both VS and IIS:

http://localhost/mrlabatch/MRLABatchProcessingService.svc/events/sr123%20eb/ACCESSCONTROL,ADT,ADTDERIVATION,ADTSTATIONNUMBER,ADTYEAR,CITY,COUNTY,FACILITYTYPE,FEDERALAIDROUTENUMBER,URBANIZEDAREA,URBANTYPE/?frommp=8.28489&tomp=10.30031

I've tried bumping my maxrequestlength up in the web.config:

Is there another obstruction to the URL size???

Upvotes: 1

Views: 270

Answers (3)

giammin
giammin

Reputation: 18968

i'm quite sure that your url is trimmed due to some invalid char or too long.

there are some limitation for url lenght.

try to use a POST instead of GET to pass so many stuff

Upvotes: 0

Michael Rut
Michael Rut

Reputation: 1027

THe issue was with the URL I was posting. I should have added the proper query string into the URL: ?events=

 http://localhost/mrlabatch/MRLABatchProcessingService.svc/events/sr123%20eb/?events=ACCESSCONTROL,ADT,ADTDERIVATION,ADTSTATIONNUMBER,ADTYEAR,CITY,COUNTY,FACILITYTYPE,FEDERALAIDROUTENUMBER,FUNCTIONALCLASSIFICATION,JURISDICTION,LEFTSHOULDERTYPE,LEFTSHOULDERWIDTH,LEFTSIDEWALKWIDTH,MASSDOTHIGHWAYDISTRICT,MEDIANTYPE,MEDIANWIDTH,MPO,NHSSTATUS,NUMBEROFPEAKHOURLANES,NUMBEROFTRAVELLANES,RIGHTOFWAYWIDTH,RIGHTSHOULDERTYPE,RIGHTSHOULDERWIDTH,RIGHTSIDEWALKWIDTH,ROUTEKEY,SPEEDLIMIT,STREETNAME,STREETOPERATION,SUBROUTE,SURFACETYPE,SURFACEWIDTH,TERRAIN,TRUCKROUTE,UNDIVIDEDLEFTSHOULDERTYPE,UNDIVIDEDLEFTSHOULDERWIDTH,URBANIZEDAREA,URBANTYPE/?frommp=8.28489&tomp=10.30031

Upvotes: 1

Davin Tryon
Davin Tryon

Reputation: 67336

Based on this article, it seems that if the URL was too long you would receive a 404 error, not a 400. I would make sure that the requests are the same other than the url length.

You could check the IIS log on the server to make sure that the url (when it reaches the server) is what you are expecting.

It seems there might be a 260 character limit for urls in the .NET framework, but I would think that this would fail in the VS web server as well.

Upvotes: 0

Related Questions