none
IMAGE FILE UPLOAD USING WCF REST WEB SERVICE

    Question

  • Hi Everyone,

    I tried to upload an image into IIS Server  from a WPF application using a REST Architecture in WCF.

    Following are the steps created for doing this

    1) Created a WCF library and used that dll inside my client side application and Web Service Site as a refrence. Created a WebInvoke Method=POST for uploading a file by passing Image byete array adn filename as parameters to the method.
    2) Created a WCF Service...deleted the default Iservice.cs and Service.cs as I am refreiing teh dll from the Service library. I am using Factory attribute inisde my Service.svc markup tag and deleted the service model tag from the Web.config. This will ensure that I can use REST .

    3) Inside my client application in the upload click event  I am refreeing System.Servicemodel.web so that I can use Web channel factory which uses the dll from the library for its declaration. I created a channel and by using the channel.Upload(filename, byte[] filecontents)..I am uploading the image from the client.

    The point is I could upload a small 4 kb image file succesffully into my external IIS server. But if I am tryng to upload an image which has size more tha 5kb i am gettingg 400 bad request error.

    I tried to keep httpruntime tag inside web,config of WebService but that didnot help. I am uanble to use binding because I am using Facory attribute in Svc file markup so that I am deleting the Service.model tag inside web.config to make it REST ful webservice.

    If you think i made any mistake how can a 4kb file uploaded into the server.

    Should I change any more settings. Sometimes the innerexcpoetion and stacktrace show me the error that ther is no enpoint found at the specified address.

    Can anyonle please help how shoudl I move forward in implmenting the file uplaod for any size.
    Tuesday, November 24, 2009 12:43 AM

Answers

All replies