For my WCF, I need to generate configuration file for my client application to specify things such as binding of service, the address 开发者_StackOverflow中文版of the service and the contract.
Type in the Microsoft Visual Studio Command Prompt
: where svcutil.exe
. On my machine it is in: C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\SvcUtil.exe
With latest version of windows (e.g. Windows 10, other servers), type/search for "Developers Command prompt.." It will pop up the relevant command prompt for the Visual Studio version.
e.g. Developer Command Prompt for VS 2015
More here https://msdn.microsoft.com/en-us/library/ms229859(v=vs.110).aspx
If you are using vs 2010 then you can get it in
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools
Try to generate the proxy class via SvcUtil.exe with command
Syntax:
svcutil.exe /language:<type> /out:<name>.cs /config:<name>.config http://<host address>:<port>
Example:
svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config http://localhost:8000/ServiceSamples/myService1
To check if service is available try in your IE URL from example upon without myService1 postfix
To find any file location
- In windows start menu Search box
- type in svcutil.exe
- Wait for results to populate
- Right click on svcutil.exe and Select 'Open file location'
- Copy Windows explorer path
I don't think it is very important to find the location of Svcutil.exe. You can use Visual Studio Command prompt to execute directly without its absolute path,
Syntax:
svcutil.exe /language:[vb|cs] /out:[YourClassName].[cs|vb] /config:[YourAppConfigFile.config] [YourServiceAddress]
example:
svcutil.exe /language:cs /out:MyClientClass.cs /config:app.config http://localhost:8370/MyService/
精彩评论