Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hello,

I have created a WCF service using stored procedure.
[WebGet]
        public List<View_JobAssign> AssignJobs(string employeeId, string assignDate, string jobs, string userId)
        {
            try
            {
                TrackerEntities entities = new TrackerEntities();
                return entities.AssignJobs(Convert.ToDateTime(assignDate), Convert.ToInt32(employeeId), jobs, Convert.ToInt32(userId)).ToList();

            }
            catch (Exception ex)
            {
                throw new DataServiceException(ex.Message + ex.InnerException);
            }
        }


The data which I pass to above service is
employeeId = 1, assignDate = "2017-02-22", Jobs="1,2,3", userid = 1
and it works like charm.
But the problem is when I try to pass Jobs = '1,2,....10000' i.e upto 10000 which makes a long string then I get HTTP request Failed Error.

How do I pass data to stored procedure created service with long data?
is there any alternative?

What I have tried:

I tried to use reflection provider with Entity Framework but it doesn't work.
Posted
Updated 18-Feb-18 15:55pm
Comments
Richard Deeming 16-Feb-18 13:11pm    
Are you getting a "request entity too large" error? If so, you'll need to increase the maxReceivedMessageSize on your binding.

If you're getting a different error, then you'll need to give us the details of that error.

Also:
throw new DataServiceException(ex.Message + ex.InnerException);
Don't do it like that; you've just thrown away the interesting details of the exception. Use:
throw new DataServiceException(ex.Message, ex);
Member 13681529 22-Feb-18 2:08am    
Yes, I am getting below error when I tried to run on browser.
Request URL Too Long
HTTP Error 414. The request URL is too long.

And then I tried the same on Rest Client. Then it said HTTP Error 400 - Bad Request.
Also, I tried maxReceivedMessageSize to 2147483647, but the issue is same.

1 solution

As Richard mentioned you would need to search google for the exact error you are getting because there are settings you can change depending on what limit you are exceeding.

However, to me, the more obvious suggestion is to cut down on how many you send at once and just loop to send smaller amounts.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900