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

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

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

Posted By:      Posted Date: October 23, 2010    Points: 0   Category :WCF

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 =


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

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

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

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

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 =

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,


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


Trying to make a SQL Server Reporting Service 2008 report public for basic users


Hey.  I'm somewhat new to SSRS 2008 and I've built two datasources connecting to "HumanResources" and "HumanResourcesDev5" databases on a single server.  Both of those datasources have been changed from a Windows NT login clone to a preset login for a temp account that we have for testing called "Test2".  I have opened my created datasets and verified that when they open they ask for the password for the new credentials that I have set for the datasources.  After verifying this and the connection I re-opened the reports that I made within Report Builder (not Report Designer a VS extension) and verified all of the dataset and datasource information.  These reports and report parts get saved to the http://localhost/Reports folder within the server.  I have published the report parts to the /Report Parts folder within the localhost. 

This is where I begin to have issues...

When someone uses the reports that I have generated through report builder and link to them on our sharepoint site when a person without an actual account on the SQL server tries to view them they cannot because they do not have sufficient permissions.  And what I noticed is that it still tries to use their Windows NT credentials rather than the temp account (Test2) that we have created which is why they

Windows Service Applications Tutorials

You can easily create services by creating an application that is installed as a service. For example, suppose you want to monitor performance counter data and react to threshold values. You could write a Windows Service application that listens to the performance counter data, deploy the application, and begin collecting and analyzing data.

WCF Tip: Using Properties in Service Contracts

you'll notice all of the Service Contracts are implemented with interfaces containing only methods. For the longest time I thought that's all that was supported, until I thought about it a little more. In C# land, properties are simply wrappers around a get method and set method, so why wouldn't we be able to use properties in a service contract? Well the answer is we can.

Realizing a Service-Oriented Architecture with .NET

This article is meant to be a practical discussion guide to building a .NET application in a service-oriented architecture. We will consider real-world goals, real-world obstacles, and experience-based solutions. I quickly concede the approaches discussed here are not exhaustive or infallible. This paper is focused on application development, not application integration. We will specifically consider architectural issues and component design issues.

The Potential of Web Services

Web Service for uploading documents into SharePoint

WS UploadService is a web service written for Microsoft Office SharePoint Server 2007 and Windows SharePoint Services 3.0 and is meant for uploading documents into SharePoint. I have just uploaded the zip file to GotDotNet.com so it will take some time before the zip file appears in the list of downloads. For the time being, you can download the zip file from the following location

Creating and Using an ASP.NET Web Service in Visual Web Developer

In addition to letting you create Web pages, Microsoft Visual Studio also lets you create Web services that use ASP.NET XML. Creating a Web service in Visual Studio is similar to creating a Web page. You can also use the Microsoft Visual Web Developer Web development tool to reference and use Web services that are in a Visual Web Developer solution, on your local computer or in a local or external UDDI directory. In this walkthrough, you will create the Web service in one solution and use it in another.

Tasks illustrated in this walkthrough include:

Creating a simple XML Web service in Visual Web Developer.

Creating a separate Web site that uses the Web service.

Beginner: this doesn't make sense to me


Do you need and "empty" script tag in the head to run scripts that are in the body?  Also, can you run JQuery scripts if they're in the <head> tag?  The first sample only works if the JQuery script is in the form (and body) tag, not in the head - even if I add $(document).ready(function() { });

This works

<head runat="server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" />
<script type="text/javascript">
<form id="form1" runat="server">
<a href="">Here is a link</a>
<script type="text/javascript">
$('a').click(function () {
alert("you clicked me!");


This doesn't work.  Notice I removed the second <script> tag from the head

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="serve

how to make a dropdownlist looks like google search box


dear all...

any idea how to do that ?

Thnx in advance

AutoGenerateSelectButton="False" ignored when using Domain Service


Crosspost from RIA Services forum: http://forums.silverlight.net/forums/t/196466.aspx

I'm creating a Dynamic Data application in VS2010 and have recently switched to using a Domain Service to give greater control over the data presented to the client. I've noticed that the AutoGenerate<Action>Button attributes on my GridView are being ignored. The presence of the Edit and Delete buttons appear to be contingent on the existence of Update and Delete methods on the partial classes autogenerated in the Domain Service, but i'm not seeing how to control the generation of the Select button. Is there a way to control this from within the Domain Service class?

Need Syntax To Make Results of LINQ Union Return Non-Generic Type



I have the below SQL which works just fine:

SELECT     Message, CreateDate, AccountId, AlertTypeId
FROM       dbo.Alerts
SELECT     TOP (100) PERCENT Status, CreateDate, AccountId,
                          (SELECT     10 AS Expr1) AS AlertTypeId
FROM         dbo.StatusUpdates
WHERE AccountId = PassedInParameter

I have been going about trying to convert the above into a LINQ method and am having problems with return types.
As the above SQL illustrates, I am querying two distinct LINQ tables - Alerts and StatusUpdates -
and then attempting to perform a Union on them. In order to do the union in LINQ, I have to have agreeing types. So, I
am using "var" to make the results of "alerts" and "updates" generic before the union.  

public IList GetStatusUpdatesAsAlertsByAccountId<T>(Int32 accountId)
            using (WorkbookDataContext dc = _conn.GetCont

Unable to make connection to database?


Hy guys. I try to connect my database for so long so i wrote two type of codes. Let's discuse first on.

I have database called PhoneDirectory.

It have only one table named Residents.

I have button wiht ID="Button1".

I want when i click this button to see all of my residents. 

I want to see the result in DetailsView and to be able to edin, delete and add new resident.

First try with SqlDataSource so i wrote this:

<asp:SqlDataSource ID="Resident Details" runat="server" ProviderName="System.Data.SqlClient" ConnectionStrings="<%$ ConnectionStrings:ThisIsTheConnection%>" 
              SelectCommand = "SELECT * FROM Resident "
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