3

When I try to run my wcf in Visual Studio 2012 I get the following error

Usage: WcfSvcHost.exe /service:<PathToServiceDLL> /config:<PathToServiceConfig> [/client:<pathToClientApp>][/clientArgs:<argumentsToBePassedToClientApp>]

I've read a few blogs that suggested something might be wrong with the environment but I can run a different project successfully.

my app.config file important settings:

<endpoint address="" binding="wsHttpBinding" contract="Sac.Business.Interfaces.IManufacturer">
<service name="Sac.Business.Logic.ManufacturerLogic" behaviorConfiguration="ManufactuerBehave">
<behavior name="ManufactuerBehave">

my svc file in a different project:

<%@ ServiceHost Language="C#" Debug="true" Service="Sac.Business.Logic.ManufacturerLogic" %>
<%@ Assembly Name="Sac.Business.Logic" %>

I'm not sure what I could be missing.

RBT
  • 24,161
  • 21
  • 159
  • 240
FaithN
  • 213
  • 1
  • 3
  • 7

4 Answers4

3

Here is the possible likely issue with your project. Right click your project's icon from solution explorer and choose Properties. This will take you to project properties window. Now in properties window go to debug tab. In right pane inside "Start action" section observe the selected option button. I'm mentioning my observations with respect to Visual Studio 2010 and I hope it will be the same in VS 2012 as well. Now :

  1. If "start project" option button is selected then check the "command line arguments" field under "Start Options" section. It should have value "/client:"WcfTestClient.exe". If there is any issue here then fix it to try resolving your issue. It is perfectly alright if "command line arguments" field is blank. Your WCF service will still get hosted successfully with only difference that wcftestclient will not get launched.
  2. If "Start external program" option button is selected then it should show fully qualified path to WcfSvcHost.exe. This path is specific to specific version of visual studio you are using. For VS 2010 on my box the path is "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\WcfSvcHost.exe". After this check the "command line arguments" field. It should have value "/service:wcfservicelibrary1.dll /config:wcfservicelibrary1.dll.config /client:WcfTestClient.exe". Here /service, /config, /client are command line arguments to WcfSvcHost.exe. "wcfservicelibrary1.dll" is the name of my wcf serice library project's binary file created in /bin/debug folder of the project. "wcfservicelibrary1.dll.config" is the name of the configuration file of my wcf serice library project created in /bin/debug folder of the project after successful build. Please note that default configuration file name changes from "app.config" to "wcfservicelibrary1.dll.config" after build process. There should be no spelling mistake while mentioning the command line parameters namely /service, /config, /client. Generally we make spelling mistakes due to which we face the issue you are facing. In addition to the above mentioned three command line arguments there is one more command line argument /clientArgs. I was using this command line argument as well and was misspelling it as /clientArg instead of /clientArgs. Once I correct this spelling the problem got resolved.

Please see if these observations can help you get rid of your issue.

RBT
  • 24,161
  • 21
  • 159
  • 240
  • 1
    Wow...thanks for posting. That is nuts. For future readers : "Start external program" instructions worked for me. – granadaCoder Mar 04 '16 at 21:11
2

I also had this issue today. Mine was resolved by right clicking on the project (I had multiple to choose from) and select "Set as StartUp Project", then right click on the service within that project that you plan to run and select "Set as start page". This resolved my issue, hope it helps someone else.

Brad Germain
  • 597
  • 1
  • 9
  • 22
1

I see that question was asked long time ago, but today I had recieved such error and maybe answer will help someone.

In my case the reason was that there was no config file in project. I'm using other host project that contains app.config file and after setting wcf service as startup project for debug purposes Visual studio doesn't see it. If so, just copy app.config from host to wcf project.

Spark13
  • 146
  • 1
  • 10
0

Just delete your IIS Express folder in "My Documents", close and start your solution again. That's how I was able to resolve my issue.