How to start WCF service outside of Visual Studio?

I just created a WCF service with this tutorial on MSDN .

  • from Visual Studio I can use CTRL-F5 to make it work
  • then I can start my console application client and not use the service without problems.

Now I want to start my visual studio OUTSIDE and use it with different clients.

But when I go to the command line and run this file .. /bin/Debug/testService.exe, I get an exception: "The input is in the wrong format ."

I get the same error when publishing a service and running a published .exe file.

What am I missing here? Do I need to send some parameter that Visual Studio sends in order to start it?

How to start an external WCF service outside of Visual Studio?

+4
source share
3 answers

Without looking at the code and configuration files, it’s hard to understand why you are getting this problem, but properly setting up the WCF service can be a bit complicated.

I recommend checking endpoint.TV screencasts for WCF and, in particular, WCF screencast self-service .

They lend themselves easily and will explain enough to get you started.

+2
source

For me, the easiest way to show someone how to get a WCF application and run it so you can learn how to do this is by hand, avoiding the built-in VS2008 tools. Here's a great tutorial that shows you what to do:

WCF Manual Way - The Right Way

I wrote an article that expanded a bit in this article in my blog post. I included the source files as well as the screencast. You can find it here:

WCF Guide - Extension

In addition, an excellent series of tutorials can be found in Michele Bustamante Training WCF . It is a bit outdated, focusing on .NET 3.0, but most examples still work, and she updated her source on her blog.

0
source
Uri baseAddress = new Uri("http://localhost:8080/hello"); // Create the ServiceHost. using (ServiceHost host = new ServiceHost(typeof(HelloWorldService), baseAddress)) { // Enable metadata publishing. ServiceMetadataBehavior smb = new ServiceMetadataBehavior(); smb.HttpGetEnabled = true; smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15; host.Description.Behaviors.Add(smb); // Open the ServiceHost to start listening for messages. Since // no endpoints are explicitly configured, the runtime will create // one endpoint per base address for each service contract implemented // by the service. host.Open(); Console.WriteLine("The service is ready at {0}", baseAddress); Console.WriteLine("Press <Enter> to stop the service."); Console.ReadLine(); // Close the ServiceHost. host.Close(); } 

http://msdn.microsoft.com/en-us/library/ms731758%28v=vs.110%29.aspx

0
source

All Articles