.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

enumerate service endpoints in web.config?

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :SharePoint

Is there a way to programatically enumerate service endpoints in web.config?  I would like to do so for my FederationMetaData Generator.



View Complete Post

More Related Resource Links

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

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.

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!




Best practice for WCF service exposing multiple client-specific endpoints?


Moving forward with re-designing a web service architecture using WCF, our team has been discussing how we want to expose the endpoints. Example: I have a standard endpoint that all users could use with the proper token, but I also have some number of endpoints that will instead use certificate security. All endpoints will ultimately use the same implementation, so this is really just different ways of getting in to the system.

The certificate endpoints will have to point to a specific certificate in the store so will only work for one specific client. The thought is that our standard service could live at http://mysite.com/MyService.svc and the certificate endpoints would be something like http://mysite.com/MyService.svc/Acme. The concern here is that I'm effectively putting our client list into our WSDL, which is not desirable.

What's the best practice here? Is there a way to direct multiple clients through a single certificate endpoint and get the cert on the code side (how would we know which client we're dealing with without a sp

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()


Exposing service with multiple endpoints


I have a service hosted as Windows Service. Now I want to make the same service availble via basicHttpBinding, wsHttpBinding.
So, I modified the my app.config as below using Microsoft Configuration editor. The WCF Service is already running on server (as Windows Service)

Note: The code (config) inside comments (below) is actual and the code inside "<!-- Newly .." is added later using config editor.
<!-- ORIGINAL -->
<!-- END - ORIGINAL -->

1. What I need to have in "baseAddresses" section for newly added endpoints (basicHttpBinding, wsHttpBinding)
2. Is newly added configuration correct?
3. Other than adding basicHttpBinding and wsHttpBinding, is there anything else that I need to do on "server"?

<?xml version="1.0" encoding="utf-8"?>
        <!-- ORIGINAL -->
        <behavior name="FirstServiceBehavior">
          <serviceMetadata httpGetEnabled="false" />
          <serviceDebug includeExceptionDetailInFaults="true" />

Service XXX has zero application (non-infrastructure) endpoints?


I have read a lot of discussions about this type of problem in this forum already.
However, I still not be able to make it works when I try to  test the service on m localhost by typing:
http://localhost/StudentService/StudentService.svc and it throws back this error 

"Service 'Dq.Services.Student.StudentService' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element. "

On the post build event, I also copy
MyDll.dll to inetpub\wwwroot\StudentService\bin   
StudentService.svc to inetpub\wwwroot\StudentService\.
Please let me know what wrong with my codes.

App.Config file:

<?xml version="1.0" encoding="utf-8" ?>
      <service name="Dq.Services.Student.StudentService&qu

"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 with both secured and unsecured endpoints?



I have a service that looks like this :

			<service behaviorConfiguration="AppClientService.CustomValidator_Behavior" name="App.ServiceImplementation.AppClientService">
    <endpoint binding="netTcpBinding" bindingConfiguration="netTcpRegular" behaviorConfiguration="AppClientService.AppClientService_Behavior" address="Regular" bindingNamespace="http://App.ServiceContracts/2007/11" contract="App.ServiceContracts.IAppClientService" />
				<endpoint binding="netTcpBinding" bindingConfiguration="netTcpUserNameMessageSecurity" address="UserName" bindingNamespace="http://App.ServiceContracts/2007/11" contract="App.ServiceContracts.IAppClientService" />
				<endpoint binding="netTcpBinding" bindingConfiguration="netTcpWindowMessageSecurity" address="Windows" bindingNamespace="http://App.ServiceContracts/2007/11" contract="App.ServiceContracts.IAppClientService" />
    <endpoint address="httpMex" binding="mexHttpBinding" contract="IMetadataExchange" />
				<endpoint address="tcpMex" binding="mexTcpBinding" contract="IMetadataExchange" />

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.

[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.

Discovery on IIS hosted WCF service no endpoints found untill site is visited


I have a problem which makes the whole discovery (.net 4) idea useless.
I got self-hosted wcf services with discovey working so I now at least something about it, however, when I create a website with a .svc file, configure the web.config well and host it in IIS something goes wrong.

I have my windows forms client program to test the discovery and it doesn't return any endpoints, not after iisreset, not after checking twice, tree-times with long timeouts. I have to manually "visit" my .svc file in the website by browser to kind of activate it and than my client recogizes it immediately.

Because you have to visit the service first, you already have to know what the url is and makes discovery pointless in this case (and I need it so much)

What can I do about this?

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

Setting of sharepoint 2010 custom WCF service "web.config" file for both HTTP and HTTPS



        I have created a custom SharePoint 2010 WCF service that is deployed to 14\ISAPI\MYService folder. The issue i am facing is that this service should be accessible from all Web applications, that can be HTTPS (i.e. SSL) enabled or normal HTTP. If i am making in web.config file for web application that has HTTPS enabled, then it fails for Web applications having normal HTTP configuration. My requirement is that when this WCF service is deployed it should accessible from all web applications that can be HTTPS or HTTP both. I went through number of blogs and tried whatever option they had suggested but none of them worked for me :(. Here are some of the blog that i tried:-

When I use interface as Contract in Web.config, I cannot call the service


I tried to use interface to define services but the JavaScript function will fail.  Without the interface, everything works perfectly.  Consider the following.

Consider the following.


namespace Enroll.ER.Services {
 [ServiceContract(Namespace = "Enroll.WebServices")] 
 interface IAccountService {
 bool Checkin(string acctKey);

namespace Enroll.ER.Services {
 [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
 public class AccountService : Enroll.ER.Services.IAccountService {
 public bool Checkin(string acctKey); {

 public class MyFaultException {
 public string Reason { get; set; }
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