vijay raj

vijay raj

  • NA
  • 1
  • 0

How to set and map a Method in the Service file with endpoint elements and binding elements

Aug 31 2010 2:31 PM
Hi all, I have created a service file like OSService.svc in that i have two methods like one is FileUpload and FileDownload for e.g :-

[WebInvoke(UriTemplate = "/fileupload/{fileName}" , Method = "POST" )]

        [OperationContract]

        void FileUpload(string fileName, Stream fileContents);

same as Filedownload also. People you may know these methods are inside the interface of service file what you are using i'e i have created a interface as IOSService.cs. So, what i need now is i want to write separate endpoint for FileUpload and Filedownload.Because i want to set separate value for receiveTimeout  and openTimeout for the Fileupload and FileDownload process in binding section in the web.config file itself.

The below code was i'm using right now but still i'm not able to the set separate value of endpoint elements in the bindings.

EndPoint Section:-
<endpoint name = "endPoint1"  address  = "localhost:8000/OSService.svc/" bindingConfiguration = "TransactionalTCP"   binding  = "netTcpBinding"
         contract = "IOSService"/>

Binding Section:-

 <binding name = "TransactionalTCP"  transactionFlow = "true"   />

The above Section is the normal way to define endpoint and binding elements. For my requirement i have created one more interface for the FileUpload and mentioned it in the contract section in the endpoint as

EndPoint Section:-

<endpoint name = "endPoint1"  address  = "localhost:8000/OSService.svc/" bindingConfiguration = "TransactionalTCP"   binding  = "netTcpBinding"
         contract = "IOSService"/>
<endpoint name = "endPoint2"  address  = "localhost:8000/OSService.svc/" bindingConfiguration = "WSHttpBinding_IFileUpload"   binding  = "netTcpBinding"
         contract = "IFileUpload"/>

Note:- The two interface(IOSService,IFileUpload) are inherited by OSService.svc service file

 and binding section as

Binding Section:-

 <binding name = " WSHttpBinding_IFileUpload"  transactionFlow = "true"   />

<binding name = " TransactionalTCP"  transactionFlow = "true"   />

My problem in the above code is i'm not able to call the methods in both interface's . So people you may how to fix this issue or is there any other way to set and map the service methods in the endpoint elements with the binding elements in the web.config file itself ?

Thanks in advance...