.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to config a SendActivity make it consumes a WCF service?

Posted By:      Posted Date: August 29, 2010    Points: 0   Category :Windows Application
In a ASP.net web project, I have a WCF service and Workflow service and my workflow service want to use the wcf service, so I use the SendActivity to consume the WCF service. I do this in the follow step: 1.Using Add the service reference dialog add the WCF service reference to my project 2.Add a SendActivity to the workflow and config it like this: EndpointConfigurationName:BasicHttpBinding_ISimpleService ServiceContractName:SimpleServices.ISimpleService OperationName:DoWork and set correct parameters.   All this config value I am copyed from the config file. But when I run this project it's always throw exception says "ContractFilter mismatch at the EndpointDispatcher" . But if I directly call the WCF service in code, it's all ok. For demo, I create a very simply WCF service and Workflow service for testing how to config, so I paste all the code here: namespace WFCallService.Services { // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "ISimpleService" in both code and config file together. [ServiceContract] public interface ISimpleService { [OperationContract] void DoWork(string workName); } } namespace WFCallService.Services { // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Sim

View Complete Post

More Related Resource Links

Windows Services: New Base Classes in .NET Make Writing a Windows Service Easy


Windows services are applications that run outside of any particular user context in Windows NT, Windows 2000, or Windows XP. The creation of services used to require expert coding skills and generally required C or C++. Visual Studio .NET now makes it easy for you to create a Windows service, whether you're writing code in C++, C#, or Visual Basic. You can also write a Windows service in any other language that targets the common language runtime. This article walks you through the creation of a useful Windows service, then demonstrates how to install, test, and debug the service.

Ken Getz

MSDN Magazine December 2001

Not able to read Config File data in Windows Service

While I'm trying to read connection string which is in App.Config file I'm getting error like "Object reference not set to an instance of an object." string strconn = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"].ToString(); For the windows service where I need to keep app.config file and how to integrate that config file with the windows service exe file. Thanks in advance.

i make a web site using frame but session is expire Error message is my Config file is attache

i make a web site using frame  but session is expire message is Object reference not set to an instance of an object Description: HTTP 500. Error processing request. Stack Trace: System.NullReferenceException: Object reference not set to an instance of an object at System.Web.UI.Control.OnLoad (System.EventArgs e) [0x00000] in <filename unknown>:0 at System.Web.UI.Control.LoadRecursive () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.ProcessLoad () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.ProcessPostData () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.InternalProcessRequest () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0 My Web Config file is<configuration>    <!-- store the database connection info here -->     <appSettings>        <add key="sBook_StoreDBConnectionString" value="Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Program Files\CodeCharge\Examples\BookStore\BookStore_MSAccess.mdb;Persist Security Info=False" />            </appSettings>  <system.web>  <httpRuntime executionTimeout=&quo

Make my WCF service return json

Iam trying to make my wcf serivce method to return JASON-object, but it dosen't work, when I open in a webbrowser it shows xml. How can I make this method to return json.I have inserted [WebGet(ResponseFormat = WebMessageFormat.Json)],,,, but it didn't help[WebGet(ResponseFormat = WebMessageFormat.Json)] protected override IEnumerable<KeyValuePair<string, SampleItem>> OnGetItems() { // TODO: Change the sample implementation here if (items.Count == 0) { items.Add("A", new SampleItem() { Value = "A" }); items.Add("B", new SampleItem() { Value = "B" }); items.Add("C", new SampleItem() { Value = "C" }); } return this.items; }[WebGet(ResponseFormat = WebMessageFormat.Json)]         protected override IEnumerable<KeyValuePair<string, SampleItem>> OnGetItems()         {             // TODO: Change the sample implementation here             if (items.Count == 0)             {                 items.Add("A", new SampleItem() { Value = "A" });  &nb

How to expose app.config or binding properties for web service

I have a project that consumes a web service, which is then bundled into a windows service and a deployment project.  Both the project consuming the web service (I'll call that the vendorcontrol) and the service project have app.config files in the project structure, but when I compile and deploy, the settings for the vendorcontrol are not accessible in the resulting project.exe.config file.  How would I make this happen?

Config Hosting multiple WCF services in one NT service


Hello there,


I've a question about hosting a service in a selfhosting scenario (not IIS or WAS).


For example, I have one WCFService with a config file (web.config). In this config file a system.serviceModel section exists, but also several appSettings.


Hosting in IIS is very simple. I created a svc file and voila, you can call the service. I do not have to place the configsettings of the WCFService into IIS.


Now I turn to host the WCFService in another host, a Windows NT service (or a win/console app).


Why do I have to place all of the WCFService configuration settings in the app.config of the NT Service? Why not just a reference to the physical path of the WCFService.


In the case of three WCFServices hosted by one NT Service, I have to place three web.config contents into the app.config of the NT Service. (Am I wrong? I hope so.)


tnx for reply!




WCF hosted in a Windows Service, how to make calls to the WCF service from within the service host


I have a Windows service that I converted to a WCF service that I want to host in a Windows Service.  I need to do some specific tasks in the OnStart() and OnStop() just like I did when it was just a Windows service.  My original Windows service OnStart() is where I create the main worker thread.  So how do I make a call into my WCF service from within the hosting service? For example in the hosting service's OnStart() I do a host.Open() then I need to call a method in my WCF service but how?



ServiceHost host =

Add Service reference not updaing the client apps web.config file in .Net Framework 4.0


Hi Team

I am doing some experiments with WCF on .Net 4.0. I have created a service in 4.0 and add a new empty web application to consume my Service. When i added a service reference from the IDE, i can see the web.config file is not updated with the Servcie end points. How do i solve this issue?

My web.config in the client looks like this after adding the service reference.

is it necessary to have a config file when creating proxy of WCF service

Sign In to Vote Hi to all,

i created a service.cs file with the following code then tried to create proxy using svcutil comand.... but it gave error "not able to obtain metadata". After some web search i found i need to add a meta endpoint to the service. so i copied and pasted the code... now svcutil works and creates the proxy.cs. BUT ITS ALSO CREATED A CONFIG FILE. i want to know Do i really need this config file?? if yes then can u please describe its content to me...i will be highly thankfull to you.


using System;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace Service
 interface Iservice
	 string getMyDeals();

 class Service : Iservice
 public string getMyDeals()


How to make ASP.NET MVC View Insecure via location tag in Web.Config


I have the following authorization settings in my web.config:

      <deny users="?" />

This deny's all anonymous access to the application accept the login page. In addition to this I am using authorization within each controller action via a custom authorize attribute.

I have one additional action that I would like to expose publicly in addition to the login page. This action does not have the authorize attribute on it. I have tried to make this view (resetPassword view) public by using the location tag in the web.config file like so:

 <location path="Account/ResetPassword" allowOverride="false">
        <allow users="*" />

In the path attribute above I have tried both the view as well as the action path, but it doesnt allow public access to the action.

I have even tried to put this view in a separate folder within the shared folder and put a separate web.config file to make that folder public like so:

"This assembly is too new"- WCF Service Config Editor


Hi Folks,

I'm trying to use the WCF Service Configuration Editor (SvcConfigEditor.exe) to setup my endpoints for a WCF service...
When I try to chose an assemblly in the editor (to setup the data contract) I get this error:

"This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."

My assemblies are built on the  .Net framework 4.0...
So I though that maybe i had a old version of this tool...and that it only recongnized .Net 3.5 assemblies...
So, I download the latest Windows windows SDK (Microsoft Windows SDK for Windows 7 and .NET Framework 4) and when I run the tool, I get the same error.....

Any ideas on what is causing this error, and how to overcome it?

(As an aside, why isn't the WCF Service Configuration Editor lauchable directly from Solution Explorer, by right cliking the Web.config file in an WCF Service Application Project.... It does for App.Config files in other WCF projects... this appears like an oversight by Microsoft...)

- Andy

Service throttling behaviour app.config settings

How can I calculate the MaxConcurrentSessions, MaxConcurrentCalls and maxConcurrentInstances properties to set in the app.config ? I believe it should have some dependency on the # of CPU and the Max and Min worker threads based on which these parameters can be set.

Can you please guide me how can I provide them the number for these properties like we could calculate for ASP.NET.

Web Service to make use of Resource File


Dear All,

I've been trying to get my Web Service in my wcf project to be able to reference the resource objects in my resource file but to no avali.

Please kindly advice and assist on what went wrong.

Thank you in advance.

Warmest Regards,


How to make WsdlExporter :: GeneratedWsdlDocuments to retun only one Service Description


Hi ,


I am using the following code to create the wsdls for my service using the following code


  BasicHttpBinding binding = new BasicHttpBinding("BasicHttp");
      WSHttpBinding wsBinding = new WSHttpBinding("WsHttp");
		WsdlExporter exporter = new WsdlExporter();
        Uri uri =  new Uri(address);
     ContractDescription contractDesc = ExportServiceContract(typeof(IService).AssemblyQualifiedName);
        EndpointAddress epAddress = new EndpointAddress(uri.ToString()+"/ws");
        ServiceEndpoint endpoint = new ServiceEndpoint(contractDesc, wsBinding, epAddress);

        EndpointAddress epAddress = new EndpointAddress(uri.ToString()+"/basic");
        ServiceEndpoint endpoint2 = new ServiceEndpoint(contractDesc, binding,epHttpAddress);



public static ContractDescription ExportServiceContract(string contract)
      Type dynamicFactoryType =

      ChannelFactory dynamicFactoryInstance =


[SOLVED] .Net 2 Service unable to access Connection String in Machine.config

I have a Windows Service I have developed in Visual Studio 2005 (C#).

It accesses a database using a connection string in machine.config.

On my Windows XP Pro 32bit (SP3) machine, it works correctly.

On my new Windows 7 Pro 64bit machine, it throws "object not set to an instance of an object" when it gets to the line where it's trying use the connection string.
This is the 'object' which is not set in Windows 7:


The machine.config has the same connection string set up on both machines.

A .Net 2 website transferred to the Windows 7 machine has no problem accessing the same connection string.

I have tried a bunch of different permissions on the machine.config and its containing folders, and setting the service to log in as Admin, but I don't know exactly what permissions are required.

Does anyone know what's going on here? Many thanks.

How to hide service addresses from in app.config in WCF


Hi All

when we use WCF Services in client application the addresses of the services store in app.config.how we can hide this addresses?when application build or pulished a file with .exe.config extention would be create that can be open using notpad(or other word processor program) easily.

is it possible to embed app,config with exe?

if not how I can do hide addresses to being see?

thanks a lot

semi developer

Make clustered MSSQL service local



Our cluster is destoyed (cluster service will not start at all), and to make a quick solution, while we create a new cluster, i need to know if i can make the SQL service local? Is mssql 2008 - sp 2

If possible - how?

Many thanks in advance


Torgeir Dølerud


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend