Questions tagged [weboperationcontext]

The WebOperationContext can be used in WCF services to access properties of web requests and responses.

The WebOperationContext can be used in WCF services to access properties of web requests and responses. It will only be useful for specific bindings.

References

22 questions
1
vote
1 answer

How System.ServiceModel.Web.WebOperationContext works when InstanceContextMode is Single?

If my WCF Service has this attribute: [ServiceBehavior( InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)] How can the following a Singleton work in a…
Jader Dias
  • 88,211
  • 155
  • 421
  • 625
1
vote
1 answer

How to write a Unit Test case in c# without using the Operation context?

In My Project i have a method PreAction() which is used in all the Methods. PreAction() contains the Operation context object i.e OperationContext currentContext = OperationContext.Current So when am trying to Invoke a Method X in that method I am…
0
votes
2 answers

Exception handling in REST service

I have a REST service and I want to have a helper class that handle exceptions My code looks as follows: [WebGet(UriTemplate = "/Test/{param}")] public Stream Test(string param) { if (param == "Ok") return Process(param); …
bzamfir
  • 4,698
  • 10
  • 54
  • 89
0
votes
0 answers

How to Create an Excel File with Two Sheets using MemoryStream (and w/o using 3rd party lib)

The project I'm working on is generating excel files as below, string contentType = "application/vnd.ms-excel; charset=utf-8"; string extension = "xls"; string fileName = "report-" + DateTime.Now.Ticks.ToString(); string contentDisposition =…
RaZzLe
  • 1,984
  • 3
  • 13
  • 24
0
votes
1 answer

WCF - Calling WebGet Request From Another Service

There is a web service I am integrating into. Service asks for an url parameter for redirection after it does its' thing. I have created a WebGet request like: myserviceUrl/redirect/someVal/someOtherVal and gave the url to the request as…
0
votes
2 answers

Authorization Header from my console not received in Restful WCF webservice

I'm actually new in C# and i'm currently building a simple basic Restful WCF webservice which using custom header authorization to proceed request public void validateHeader(string requestBody) { try { …
RLHakim
  • 3
  • 2
0
votes
2 answers

C# - HttpWebResponse Header Not Being Set

I'm attempting to set the content-length of my outgoing response headers but my code seems to have no effect on the headers. web_op_context.OutgoingResponse.Headers.Set("Content-Type", http_req.content_type); …
1
2