Click here to Skip to main content
16,019,876 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to pass binary vale of image as parameter through URL of Web service Method(WCF). Below is the code, Which I have used in c#.net to Invoke WCF Method with two parameters: CompanyID (Integer) and image Data.

           BaseServiceURL = ConfigurationManager.AppSettings["ServiceURL"];
           var url = BaseServiceURL +"wsAuthorization.svc/InsertAuthorizationMobile"
+ "/" + CompanyID+ "/" + "0xFFD8FFE000104A46494600010101006000600000FFDB004300080606070605080707070909080A0C140D0.....";

           var request = (HttpWebRequest)WebRequest.Create(url);
           request.Method = "GET";

           var response = (HttpWebResponse)request.GetResponse();


           response.Close();


its giving error due to image data. Does anyone have a solution?
Posted
Updated 1-Apr-15 18:51pm
v2
Comments
Kornfeld Eliyahu Peter 29-Mar-15 6:10am    
What error?
chikusuthar 2-Apr-15 1:00am    
Underlying connection was closed.

I think this error occurred due to Large Image Data.
My Question is that can we pass image data as i mentioned above code.??
Rajat_RJT 30-Mar-15 3:15am    
What error you are getting and why you don't use POST method for passing such large data?
chikusuthar 2-Apr-15 1:00am    
Underlying connection was closed.

I think this error occurred due to Large Image Data.
My Question is that can we pass image data as i mentioned above code.??
Rajat_RJT 3-Apr-15 1:41am    
No, its not possible to pass huge data in querystring.

1 solution

You can not pass huge data through query string because query string/url has some limitation. Referance[^]

But you can achive your goal with the help of posting data to your service. for uploading image using service you can refer this articles

File Upload using WCF REST API and JavaScript[^]

http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/uploading-a-file-using-wcf-rest-service/[^]
 
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