Questions tagged [wcf]
Windows Communication Foundation is a part of the .NET Framework that provides a unified programming model for rapidly building service-oriented applications.
50,809
questions
1185
votes
16
answers
1.0m
views
Collection was modified; enumeration operation may not execute
I can't get to the bottom of this error, because when the debugger is attached, it does not seem to occur.
Collection was modified; enumeration operation may not execute
Below is the code.
This is a ...
840
votes
18
answers
317k
views
Best Practices for securing a REST API / web service [closed]
When designing a REST API or service are there any established best practices for dealing with security (Authentication, Authorization, Identity Management) ?
When building a SOAP API you have WS-...
504
votes
11
answers
226k
views
WCF vs ASP.NET Web API [closed]
I've spent a few months trying to grasp the concepts behind WCF and recently I've developed my first WCF service application.
I've struggled quite a bit to understand all the settings in the config ...
493
votes
13
answers
472k
views
WCF - How to Increase Message Size Quota
I have a WCF Service which returns 1000 records from database to the client. I have an ASP.NET WCF client (I have added service reference in asp.net web application project to consume WCF).
I get ...
436
votes
6
answers
282k
views
REST / SOAP endpoints for a WCF service
I have a WCF service and I want to expose it as both a RESTfull service and as a SOAP service.
Anyone has done something like this before?
428
votes
11
answers
627k
views
POSTing JsonObject With HttpClient From Web API
I'm trying to POST a JsonObject using HttpClient from Web API. I'm not quite sure how to go about this and can't find much in the way of sample code.
Here's what I have so far:
var myObject = (...
423
votes
26
answers
118k
views
What is the best workaround for the WCF client `using` block issue?
I like instantiating my WCF service clients within a using block as it's pretty much the standard way to use resources that implement IDisposable:
using (var client = new SomeWCFServiceClient())
{
...
389
votes
35
answers
399k
views
Could not find default endpoint element
I've added a proxy to a webservice to a VS2008/.NET 3.5 solution. When constructing the client .NET throws this error:
Could not find default endpoint element that references contract '...
388
votes
5
answers
368k
views
What are the differences between WCF and ASMX web services?
I am totally confused between WCF and ASMX web services. I have used a lot of web services in my earlier stage, and now there is this new thing introduced called WCF. I can still create WCF that ...
343
votes
50
answers
431k
views
The breakpoint will not currently be hit. No symbols have been loaded for this document in a Silverlight application [duplicate]
Ok, what I have:
Visual Studio 2010 RC, W7 x64, started a new project type of Silverlight application. Hosting the Silverlight application in a ASP.NET Web Application Project. Silverlight Version 3....
338
votes
16
answers
465k
views
The provided URI scheme 'https' is invalid; expected 'http'. Parameter name: via
I am trying to make a WCF service over basicHttpBinding to be used over https. Here's my web.config:
<!-- language: xml -->
<service behaviorConfiguration="MyServices....
317
votes
6
answers
150k
views
Guid is all 0's (zeros)?
I'm testing out some WCF services that send objects with Guids back and forth. In my web app test code, I'm doing the following:
var responseObject = proxy.CallService(new RequestObject
{
Data = "...
287
votes
12
answers
229k
views
WCF on IIS8; *.svc handler mapping doesn't work
I'm trying to get a WCF service running in IIS8 on Windows Server 2012 build 8400.
When installing the web role the WCF stuff (under 3.51) wasn't to be found like in Windows Server 2008.
When ...
238
votes
6
answers
217k
views
Namespace for [DataContract]
I can't find the namespace to use for [DataContract] and [DataMember] elements. According to what I've found, it seems that adding the following should be enough, but in my case it is not.
using ...
237
votes
6
answers
242k
views
How do I return clean JSON from a WCF Service?
I am trying to return some JSON from a WCF service. This service simply returns some content from my database. I can get the data. However, I am concerned about the format of my JSON. Currently, the ...
229
votes
11
answers
174k
views
Nesting await in Parallel.ForEach [duplicate]
In a metro app, I need to execute a number of WCF calls. There are a significant number of calls to be made, so I need to do them in a parallel loop. The problem is that the parallel loop exits ...
219
votes
8
answers
141k
views
Post an empty body to REST API via HttpClient
The API I'm trying to call requires a POST with an empty body. I'm using the WCF Web API HttpClient, and I can't find the right code that will post with an empty body. I found references to some ...
206
votes
8
answers
166k
views
When to use DataContract and DataMember attributes?
I am very confused about the DataContract attribute in WCF. As per my knowledge it is used for serializating user defined type like classes. I wrote one class which is exposed at client side like this....
205
votes
6
answers
150k
views
Cannot serve WCF services in IIS on Windows 8
When I try to serve a WCF service on IIS in a Windows 8 machine, I get the well known error
The page you are requesting cannot be served because of the extension configuration. If the page is a ...
205
votes
12
answers
198k
views
HTTP could not register URL http://+:8000/HelloWCF/. Your process does not have access rights to this namespace
I'm a beginner in WCF, but trying to improve my experience. And on the first step I faced the problem. I created the simplest WCF service. The listing of code: (all the code in one file)
using System;
...
194
votes
17
answers
398k
views
The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication
The communication object, System.ServiceModel.Channels.ServiceChannel,
cannot be used for communication because it is in the Faulted state.
What is this error all about, and how would I go about ...
190
votes
11
answers
225k
views
Where can I find WcfTestClient.exe (part of Visual Studio)
The MSDN docs state that I can find the WCF Test Client in:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\
but it seems like a lot of stuff is missing from there, including ...
190
votes
7
answers
172k
views
WCF service startup error "This collection already contains an address with scheme http"
I built a web application containing a WCF service contract and a Silverlight control which makes calls to that WCF service. On my development and test servers it works great.
When I deploy to our ...
186
votes
25
answers
242k
views
CryptographicException 'Keyset does not exist', but only through WCF
I have some code that makes a call to a third party web service that is secured using X.509 certification.
If I call the code directly (using a unit test) it works without any problems.
When ...
184
votes
1
answer
6k
views
Catch-22 prevents streamed TCP WCF service securable by WIF; ruining my Christmas, mental health
I have a requirement to secure a streamed WCF net.tcp service endpoint using WIF. It should authenticate incoming calls against our token server. The service is streamed because it is designed to ...
176
votes
6
answers
363k
views
Turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server
I have a WCF service that has been working perfectly, and something has changed and I don't know what.
I get this exception:
System.ServiceModel.FaultException: The server was unable to process ...
175
votes
14
answers
215k
views
How to add a custom HTTP header to every WCF call?
I have a WCF service that is hosted in a Windows Service. Clients that using this service must pass an identifier every time they're calling service methods (because that identifier is important for ...
170
votes
9
answers
123k
views
WCF ServiceHost access rights
I get the following error when going through the WCF tutorial.
HTTP could not register URL http://+:8000/ServiceModelSamples/Service/. Your process does not have access rights to this namespace (see ...
169
votes
17
answers
122k
views
Sometimes adding a WCF Service Reference generates an empty reference.cs
Sometimes adding a WCF Service Reference generates an empty reference.cs and I cannot reference the service anywhere in the project.
Has anyone encountered this?
166
votes
4
answers
202k
views
How to turn on WCF tracing?
Update:
I have been trying to turn on WCF tracing, but still no success... Below is my lastest update.
Do I need a permission to write to the below location?
<system.diagnostics>
<...
160
votes
17
answers
309k
views
(413) Request Entity Too Large | uploadReadAheadSize
I've written a WCF service with .NET 4.0, which is hosted on my Windows 7 x64 Ultimate system with IIS 7.5.
One of the service methods has an 'object' as argument and I'm trying to send a byte[] which ...
151
votes
19
answers
417k
views
How to solve "Could not establish trust relationship for the SSL/TLS secure channel with authority"
I have a WCF service hosted in IIS 7 using HTTPS. When I browse to this site in Internet Explorer, it works like a charm, this is because I have added the certificate to the local root certificate ...
149
votes
4
answers
128k
views
How to retrieve the LoaderExceptions property?
I get a error message while updating my service reference:
Custom tool warning: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
How can ...
148
votes
5
answers
206k
views
How can I ignore a property when serializing using the DataContractSerializer?
I am using .NET 3.5SP1 and DataContractSerializer to serialize a class. In SP1, they changed the behavior so that you don't have to include DataContract/DataMember attributes on the class and it will ...
141
votes
5
answers
212k
views
Increasing the timeout value in a WCF service
How do I increase the default timeout to larger than 1 minute on a WCF service?
140
votes
11
answers
149k
views
Could not find an implementation of the query pattern
In my silverlight application I am trying to create a database connection using LINQ.
First I add a new LINQ to SQL class, and drag my table called "tblPersoon" into it.
Then in my service file I try ...
140
votes
14
answers
138k
views
What replaces WCF in .Net Core?
I am used to creating a .Net Framework console application and exposing a Add(int x, int y) function via a WCF service from scratch with Class Library (.Net Framework). I then use the console ...
138
votes
5
answers
104k
views
Difference between web reference and service reference?
What is the difference between web reference and service reference in WCF?
Which is preferable in WCF?
131
votes
27
answers
342k
views
ContractFilter mismatch at the EndpointDispatcher exception
I have the following scenario that I'm trying to test for:
A common WSDL
WCF endpoint that implements objects based on the WSDL and is hosted in IIS.
A client app that uses a proxy based off the WSDL ...
131
votes
8
answers
109k
views
MemoryCache Thread Safety, Is Locking Necessary?
For starters let me just throw it out there that I know the code below is not thread safe (correction: might be). What I am struggling with is finding an implementation that is and one that I can ...
129
votes
4
answers
78k
views
Decompressing GZip Stream from HTTPClient Response
I am trying to connect to an api, that returns GZip encoded JSON, from a WCF service (WCF service to WCF service). I am using the HTTPClient to connect to the API and have been able to return the JSON ...
129
votes
6
answers
155k
views
Can we create custom HTTP Status codes?
I have a REST and WCF service and want to send a custom status code based on the operation.
For example when some validation fails then I want to send HTTP 444 and when authorization fails I want to ...
126
votes
32
answers
368k
views
Error 5 : Access Denied when starting windows service
I'm getting this error when I try to start a windows service I've created in C#:
My Code so far:
private ServiceHost host = null;
public RightAccessHost()
{
InitializeComponent();
}
protected ...
120
votes
2
answers
45k
views
What is the difference between a WCF Service Application and a WCF Service Library?
I am developing a WCF web service and I used the WCF Service Application template to do that.
Does creating a "WCF Service Application" fulfill this requirement?
What are the advantage of creating a ...
119
votes
4
answers
139k
views
System.ServiceModel not found in .NET Core project
I have a .NET Core xUnit project. I'm trying to call a WCF service from it but get the following exception:
System.InvalidOperationException occurred
HResult=0x80131509
Message=An error occurred ...
119
votes
2
answers
219k
views
CORS - How do 'preflight' an httprequest?
I am trying to make a cross domain HTTP request to WCF service (that I own). I have read several techniques for working with the cross domain scripting limitations. Because my service must accommodate ...
114
votes
6
answers
146k
views
Web Service vs WCF Service
What is the difference between them?
When would I opt for one over the other?
110
votes
6
answers
177k
views
Where is svcutil.exe in Windows 7?
For my WCF, I need to generate configuration file for my client application to specify things such as binding of service, the address of the service and the contract.
110
votes
12
answers
112k
views
How to use Fiddler to monitor WCF service
I have a WCF service that accepts a complex type and returns some data. I want to use Fiddler to see what the incoming requests to the service looks like. The client is .net console app which uses a ...
107
votes
10
answers
61k
views
How do I pass values to the constructor on my wcf service?
I would like to pass values into the constructor on the class that implements my service.
However ServiceHost only lets me pass in the name of the type to create, not what arguments to pass to its ...