.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

Invoke WXF Service runtime without using SVCUTIL or addservice reference

Posted By:      Posted Date: October 26, 2010    Points: 0   Category :WCF
Hi Guys,

I wanted to develop a wcf service and  i  wanted to invoke this wcf service in client application  by generating the proxy at runtime and use this proxy to incoke the methods of the WCF service. I have an idea how to develop wcf proxy  by using either SVCUtil.exe or Addservice Option in Visual studio. But My client wants to generate this proxy at runtime only as i have the service endpoint available to my client application .As I know the service Endpoint in my client applicatio( Like http://localhost/ HelloWcfservice/Service.svc)  ,now i have to use this service url and needs to generate the proxy class for this service and use this proxy to invoke the methods.

I got some basic info on this..is like this

As i have this Service URL ,I will get the Metadata of that service at runtime. and then from this Metadata i will generate a proxy and invoke the Methods of the service.  But i don't have any sample how i can do this .Can someone please help me with this how i can complete this task


View Complete Post

More Related Resource Links

svcutil ( wrong code) and add service reference (works smoothly)


Hi all,

I have a web service at java and I want to consume it with wcf. When I use add service reference to create the proxy everything works ok! When I tried to generate the proxy with svcutil it's generates me two files (*.cs and app.config) which I think is all I need. But nothing works, no errors but when I try to call the services I get nothing!!! But in the case you can't use add service reference (like an authenticated scenario which is the next step for me) what can I do? Why is this happening?Can someone help me?


Custom tool error: Failed to generate code for the service reference 'CompanyService'. Please che


A little background because I feel I have an out of the ordinary architecture in place and don't know if this is contributing to the problem. 

We have an existing ASP.net application that is undergoing expansion.  The new functionality is all written in Silverlight 4.  As part of that expansion I gutted all the old Linq to SQL and put Entity Framework 4 into place.  To do this I created a standard .net Class Library and added my edmx files there.  Naturally, the business entities created by this cannot be used in Silverlight.  So I created a Silverlight Class Library and added all the business entities to that Silverlight Class Library as linked files.  I changed the name space to be the same.

So I have the following assembly / namespaces

Company.Project.Dal.csproj / Company.Project.Entities (.net 4 class library)

Company.Project.Entities.csproj / Company.Project.Entities (SL4 class library)

With this architecture I was able to share my business entities with my SL enabled web services, my asp.net projects, my silverlight projects.  Really it's a beautiful thing.

Once this was done I added "message" classes to Company.Project.Dal and again shared them with the other entites using linked files.  These messages are things like MyObjectRequest; they are class

Cannot get service reference for Net.tcp service hosted in IIS7

HiI've got a service that I want to host in IIS7. The service runs over net.tcp (currently without security), but I am unable to create a service reference to it, or call it, using the net.tcp protocol. My event log is populated with lots of errors related to ASP.NET and System.ServiceModel, relevant services are installed and running (net.tcp port sharing service and net.tcp listener adapter).O/S : Window7 RTMDevStudio: 2008I publish the webservice to IIS7 and I get a valid page when navigating to the published .svc file (which tells me to use svtutil.exe and point it at the net.tcp endpoint).For that, I get this error :    The message could not be dispatched because the service at the endpoint address 'net.tcp://gedm-desktop.profiledc01.appdevelop.local/ManageAVMEP/ManageAVMAgent.svc/mex' is unavailable for the protocol of the address.Googling the problem leads me down several blind alleys :(I cannot determine what is causing the net.tcp listener to keep stopping? Everything is fine if I use the wsHttpBinding.Any tips or pointers to a course of action would be appreciated.ThanksGed My event log is full of errors (here is a sample) :-------An error occurred while trying to listen for the URL '/LM/W3SVC/1/ROOT/ManageAVMEP'. This worker process will be terminated. Sender Information: net.tcp Exception: System.ServiceModel.WasHos

invoke an Oracle BPEL asynchronous web service from asp.net

I'm trying to invoke an Oracle BPEL web service from asp.net (vb) and having trouble getting it to work.  This is the portion of my code in the Page_Prerender event: Dim nlsWorkFlow As New soaslab.IIRWorkFlowProcessRequest Dim binding As New soaslab.IIRWorkFlowBinding nlsWorkFlow.input = Session("IIRID").ToString binding.Begininitiate(nlsWorkFlow, Nothing, Nothing) The web service doesn't launch though. I'm not a web service expert, so seeing if anyone else may know how to get this going.  I don't need to track the web service - just need to launch it.  

Problems with a .NET4 Control GAC Reference failing at runtime but fine during debugging

I believe this question is specific to the CLR how ever I will test this in a Forms Application later. I have multiple .Net 4 Targeted WPF Applications that Reference Non Microsoft .NET 4 WPF Controls that I can confirm are in the GAC. Everything Debugs Great (Noting that none of the references are copied to the output directory) and Install's well using a Setup Package and manually installing has the same effect even after a reboot. The problem is the application will not start even as an administrator as it does not find the Control References in the GAC. This also happens if I try to start the application manually in the visual studio output Directory. I can also confirm that opening the application in reflector that reflector is able to correctly find the references. Finally if I copy the controls (.dll's) to the location of the application everything runs as expected for all the above issues.   My question here is why is my application not able to load the .NET 4 controls from the GAC? Also note that everything uses a Strong Name.

Can't Add Service Reference in VS 2010 to a net.tcp endpoint

I've got a service running (well, it doesn't crash), but when I try to add a Service Reference to it, I keep getting Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:55555/mex'. Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:55555/mex'. If the service is defined in the current solution, try building the solution and adding the service reference again. The pertinent parts of my config file are:   <netTcpBinding> <binding name="ReliableDuplexBinding" closeTimeout="00:00:10" openTimeout="00:00:10" receiveTimeout="00:00:30" sendTimeout="00:00:15" maxBufferPoolSize="1048576" maxBufferSize="262144" maxReceivedMessageSize="262144"> <readerQuotas maxDepth="33" maxStringContentLength="100000" maxArrayLength="131072" maxBytesPerRead="262144" maxNameTableCharCount="54000" /> <reliableSession inactivityTimeout="05:00:00" enabled="true" /> <security mode="None"> <transport> <extendedProtectionPolicy policyEnforcement="Never" /> </transport> </security> </binding> </netTcpBinding> <behaviors> <serviceBehaviors> <behavior nam

Deploy XBAP application with WCF Service Reference into multiple environments

Hi, we have a multiple environment setup (local, Development servers, QA servers, prod servers, etc.) and we are building an XBAP application that uses WCF Services to connect to databases.  We code and unit test everything locally and then deploy to our Development servers for more thorough unit testing.  The issue that we are having is that we don't see how to update the deployed XBAP application to use the Development server deployed WCF Service.  The only way we've been able to do this is by having to change the reference on my local machine, complie, and redeploy the XBAP.Question:  How do we configure a deployed XBAP's Service Reference to point to the same service on a different server than what it was originally compiled/deployed with?  (Like in some configuration file...NOTE: but we also don't see a config file after deploying the XBAP.)  We don't want to have to update the Service Reference for QA, Prod, Training, Stage, etc. on our local machines, compile and redeploy every time we need to migrate the application to a new environment.Thanks!

How do I generate service reference activities in my rehosted designer

My desginer is used to create lots of xamlx workflows.  These are hosted in app fabric. From Visual Studio I can add a service reference that points to my workflows, and it generates activities in my toolbar that I can use to call my service from another workflow. I'd like to do the same thing from my rehosted designer.  I figured it would be something like calling svcutil.exe, but couldn't find any information on this. Does anybody know how to create xaml activities by pointing at a service for a workflow designer rehost?   CheersJason Bolstad

How to generate service reference for Workflow service from command line?

Is there a way to generate service reference for Workflow service from command line using just dll file (without metadata, without wsdl). I tried using svcutil but i didn't succeed. just error without any meaningful message. udione

Problem adding a Service Reference


Hello all.

I am developing a Web Application using Visual Studio 2010 in witch I have to add a Service Reference to http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl.

The problem is that my company's network requires a proxy authentication. So when I enter the "Add Service Reference" dialog, paste the url and click "go" I get a "(407) Proxy Authentication Required" error and cannot add the service.

I also tried using svcutil but the result, obviously, was the same.

How can I work around this? Is there somewhere I can specify the required proxy? Googling around, I found some comments that it can be specified in the Web.config, but I can't find more details on how to do this.

Thanks in advance.

How to invoke c# function from another project without adding reference?



There is a C#.net libraray project whose dll name is customer.dll. It has a class name customer with a function name show(). I want to call this function from another project but dont want to add reference to the caller project. Can this be done? Is there any C#.net class that can acheive this?

svcutil /metadata - how to export metadata for service contract that has generic type



I am using svcutil /metadata to get metadata for a WCF service project assembly, the service class implements the IChildServiceContract below, and the IChildServiceContract interface implements a base interface which accept a generic type.

public interface IChildServiceContract : IServiceBaseContract<string>

I can generate metadata for IChildServiceContract , I am curious and also want to try generate meta data for base interface, an error come up which seems have problem with the generic based contract:

There was an error exporting the contract loaded from the type: xxx.xxx.xxx.IServiceBaseContract`1

Is it possible to generate metadata in this situation?


Thanks in advanced


Cannot reference dll in windows service



I've created a windows service in VS 2010 which references the model conveniently placed in a separate project which compiles to a dll. I have no problem referencing this dll in other parts of my solution (web apps), but in my windows services the following symptoms display:

  1. Compiler error: The type or namespace %%% cannot be found (are you missing....
  2. I add a reference to %%% (directly to a dll copy or to the project, makes no difference).
  3. The compile error disappears.
  4. I build.
  5. The compile error reappears.

Using fw4.

What's up with that?

Edit: I can add and use other dlls ofcourse. Third party and microsoft's.

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.

WCF session client service reference "State" is not updated when the server side has closed


I am using vb.net (Visual Studio 2008 with framework 3.5). I have a server that exposes several services requiring sessions. I am using wsHttpBinding for all. One of my requirements is to allow non-dot net third parties to access these services. When a client connects to a service and then some time later the server goes away, the state of the connection is still reporting "open".

Currently I have implemented a "ping" function on the server. My client calls this function every 5 to 10 seconds and if the server does shutdown, I get alerted with an exception error. This works, but I was wondering if there is a way where I don't have to call my ping function?

I don't want to use a dual connection binding and I was hoping to use the connection state variable? But, I don't know how to get it to update by itself. The client user application could just wait until it goes to invoke a service method, but I was wondering if there was another way.

Thanks in advance!!


Can a table name impact generating the service client when creating Service Reference?


I have a new WCF service I'm writing under VS2010 and IIS 7.5.  The service includes a table named Client.

When I built my test class and added the service reference, the first test was confirming the creation of the client.

My service reference did not generate any client that I could call .Open on!!!! I was wondering if it is due to that table name???

 Edited to add that I tested the service through the browser and it brings up the page and XAML fine.

Thanks for any assistance!

How to invoke WCF service from another workflow in VS 2010

How to invoke WCF service from another workflow in VS 2010
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