I will post this question even though I see that there are few others similar to this one. However I am not able to find satisfying solution on either why I get this error nor how to solve it.
So, today I had to host a service on my local computer for testing purposes. The service is a single WCF service solution and it's been working as far as I know for a long time. However when I downloaded the project and tried to host the service on my local machine I got the error from the title:
This operation is not supported in the WCF Test Client because it uses type System.Threading
So when I got back home I decided to make a service using some async methods and get to the bottom of this. However I was really surprised when I get this exact same error on almost empty project which is not using (or at least it seems so) the System.Threading.Tasks
anywhere.
So what I did:
- Created new
WCF Service
using Visual Studio 2013 default template - Left the default
IService1.cs
file andService1.svc
Changed the
IService1.cs
to :using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.ServiceModel.Web; using System.Text; namespace WcfService { [ServiceContract] public interface IService1 { [OperationContract] int GetEmpId(int id); } }
Changed the
Service1.svc
to:using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.ServiceModel.Web; using System.Text;
namespace WcfService { public class Service1 : IService1 { public int GetEmpId(int id) { return id; } } }
And leaving the default web.config
which looks like this:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
I haven't even tried to use Task
, Threading
or something like that, just wanted to see that my service is up and running so I can start adding things and see when exactly I'll get the error but for my surprise after setting Service1.svc
as my startup class and trying to run the project I got the same error :
This operation is not supported in the WCF Test Client because it uses type System.Threading
Ok, now I'm completely lost. I was getting this error after several attempts to run my project. Just before posting this question I tried again and this time I didn't get the error. In fact I just finished my client and I'm able to consume the GetEmpId()
method.
So what is going on here. This is screenshot when I build my project:
I don't have method GetEmpIdAsync()
. I haven't tried to add it. And how it comes it won't build several times and now all of a sudden I'm able to use the method that I actually have implemented from the very beginning?