Questions tagged [wcf-behaviour]
34 questions
20
votes
2 answers
Custom Behavior won't register in my web.config
I have a working application using Json.NET (newtonsoft) as a custom serializer. Currently I'm adding this derivative of WebHttpBehavior in a custom WebServiceHostFactory. See the code snippet at the end of this blog for how I've attached it.
As I'm…

Gaute Løken
- 7,522
- 3
- 20
- 38
6
votes
1 answer
SecurityException when loading an app with a WCF behaviorExtension in the app.config over the network
I have an .NET 4 .exe (Winform Desktop app) to which I have added a WCF behaviorExtension. The app loads fine on the local machine, but throws a SecurityException when loaded across the network. If I omit the setMaxFaultSizeBehavior…

MarkGr
- 1,048
- 11
- 13
5
votes
1 answer
Unit Testing a WCF Behavior Extension
This is driving me crazy. I have an extension which we use to alter the Content Response of a request if there is an error. Basically, if everything works it gets serialized to JSON as normal, but if we get an unhandled exception, we serialize…

xximjasonxx
- 1,192
- 2
- 11
- 27
4
votes
1 answer
WCF endpointBehaviors extension not picked up when the name param is present?
I am trying to extend my service endpoint behaviour with custom MessageInspector, extension works fine and its picked up, but only if I don’t define the “name” parameter on behaviour tag and don’t define specific behaviorConfiguration on the…

Vojtiik
- 2,558
- 1
- 17
- 21
4
votes
1 answer
WCF challenge (in AfterReceiveRequest method of IDispatchMessageInspector Interface)
I'm getting some values in AfterReceiveRequest and want to use that in BeforeSendReply in WCF.
Please help me, how I can do that. I'm working in C# project files. I can't use Seesion, ViewState here. I can use
static fields, but It will not a good…

John Smith
- 91
- 2
- 11
4
votes
3 answers
How to call a WCF service Synchronously
I have a WCF service and I am creating the client using the "Add service reference" from VS 2010.
The issue is that service is being invoked asynchronously though "Generate Asynchronous Operations" options unchecked.
So how can I call the service…

Ananth
- 10,330
- 24
- 82
- 109
3
votes
2 answers
Setting custom WCF-binding behaviour via .config file - why doesn't this work?
I am attempting to insert a custom behavior into my service client, following the example here.
I appear to be following all of the steps, but I am getting a ConfigurationErrorsException. Is there anyone more experienced than me who can spot what…

Andrew Shepherd
- 44,254
- 30
- 139
- 205
3
votes
0 answers
Why is my programatically added FaultContract not recognized?
I try to have my WCF services always throw detailed faults, even when not throwing them explicitly. To achieve it, I implemented:
an ErrorHandler, whose IErrorHandler.ProvideFault wraps the non-fault error as FaultException
a ServiceBehavior…

user3058082
- 203
- 1
- 2
- 7
3
votes
1 answer
Get SignalR User (Hub.Context) outside of hub
is there any way to get current signalR request user outside the hub? I can use Hub.Context.User inside of hub methods, but if hub method calls any other underlying layer? Wcf service call - an additional BehaviorExtensionElement is used to add wcf…

lavrik
- 1,456
- 14
- 25
2
votes
1 answer
Can't add custom WebHttpBehavior: Cannot add two items with the same key
First a little bit of background: I have a REST service in WCF 4 that uses a WebHttpEndpoint. Rather than having explicit error handler in every service method, or even every service class, I'd like to have a centralized error handling that does…

kodbuse
- 990
- 2
- 9
- 20
2
votes
1 answer
Something like an operation filter in WCF REST?
I am looking for something like the AuthorizeAttribute in MVC, something I can use like this:
[WebGet(UriTemplate = "data/{spageNumber}")]
[WebCache(CacheProfileName = "SampleProfile")]
[WcfAuthorize]
public IEnumerable…

vtortola
- 34,709
- 29
- 161
- 263
2
votes
1 answer
In WCF can you re-use endpoint behaviors, service behaviors and bindings?
In WCF can you re-use endpoint behaviors, service behaviors and bindings?
Or must each service / endpoint have distinct ones even if they are the same except for their ID.

Matt
- 25,943
- 66
- 198
- 303
2
votes
1 answer
How do you differentiate between application and infrastructure endpoints?
I'm creating a custom behaviour for WCF which can (for interoperability reasons) only function correctly when a service exposes a single application endpoint.
I would like to be able to use the IServiceBehavior.Validate method to check that only one…

Paul Turner
- 38,949
- 15
- 102
- 166
2
votes
1 answer
How to set endpointBehaviors name when calling wcf service using ClientBase
I have client endpoints in database not in web.config. I am using ClientBase which has number of constructor where I can pass binding, address etc.. and can call client wcf service. I have binding configuration and behavior configuration defined…

user1186065
- 1,847
- 3
- 17
- 22
2
votes
2 answers
How to add OperationBehavior for all operations on IIS hosted WCF service?
I have a custom OperationBehavior. I would like to apply it for all operations at once.
Unfortunately, OperationBehaviors cannot be configured per entire service or in web.config.
When hosting WCF service in a test application, I can do the…

JustAMartin
- 13,165
- 18
- 99
- 183