Generating WCF proxy using svcutil.exe
Visual Studio 2008 has made our WCF life a lot
Easier with the ability to self-host the services and also allow debugging
In our service.
What if we were pushed to a situation wherein we need to use the tool svcutil.exe to create our proxy for the client... Hmm...
To do so,We need to have our service running. Once the service is up
And running, we cocould generate the proxy by the following command (replace
Tags correspondingly ):
1:Svcutil/T: Code http:// <Service_url>
2:/Out: <File_name>. CS/config: <file_name>. config
Here is my example:
1:C: \ Users \ chaks \ Documents \ Visual Studio 2008 \ projects \ myservice \ myservicehost>
2:Svcutil/T: Code http:// Localhost: 8731/design_time_addresses/myservice/wcfservice/
3:/Out: Myserviceproxy. CS/config: myserviceproxy. config
4:Microsoft (r) service model metadata Tool
5:[Microsoft (r) Windows (r) Communication Foundation, version 3.0.20.6.648]
6:Copyright (c) Microsoft Corporation. All rights reserved.
7:
8:Attempting to download metadata from'Http: // localhost: 8731/design_time_addresse
9:S/myservice/wcfservice /'UsingWS-Metadata Exchange or disco.
10:Generating files...
11:C: \ Users \ chaks \ Documents \ Visual Studio 2008 \ projects \ myservice \ myservicehost \ MYS
12:Erviceproxy. CS
13:C: \ Users \ chaks \ Documents \ Visual Studio 2008 \ projects \ myservice \ myservicehost \ MYS
14:Erviceproxy. config
Now we can add this. CSFile to the client project and copy
. ConfigFile contents to the client'sApp. configFile and
Execute the client
We can also instruct svcutil to generate the proxy in the preferred language
We want:
1:Svcutil/T: code/Language = VB
2:HTTP:// Localhost: 8731/design_time_addresses/myservice/wcfservice/
3:/Out: Myserviceproxy. Vb/config: myserviceproxy. config
Servicemodel metadata utility (svcutil.exe)
Servicemodel metadata utility is used to generate a service model based on metadata documents.CodeAnd generates metadata documents based on the service model code.
Metadata: used to describe the content, coverage, quality, management method, data owner, and data provision method of elements, datasets, or datasets.
Svcutil Command Options:
- /Async simultaneously generates synchronous and asynchronous method signatures. Default setting: only the synchronous method signature is generated. Abbreviated form:/
- /Config: <Configuration File> specifies the file name for the generated configuration file. Default setting: output. config
- /Out: <File> specifies the file name for the generated code. Default setting: the name of the WSDL definition derived from a schema, the name of the WSDL service, or the target namespace. Abbreviated form:/o
Visual Studio 2008 has made our WCF life a lot
Easier with the ability to self-host the services and also allow debugging
In our service.
What if we were pushed to a situation wherein we need to use the tool svcutil.exe to create our proxy for the client... Hmm...
To do so,We need to have our service running. Once the service is up
And running, we cocould generate the proxy by the following command (replace
Tags correspondingly ):
1:Svcutil/T: Code http:// <Service_url>
2:/Out: <File_name>. CS/config: <file_name>. config
Here is my example:
1:C: \ Users \ chaks \ Documents \ Visual Studio 2008 \ projects \ myservice \ myservicehost>
2:Svcutil/T: Code http:// Localhost: 8731/design_time_addresses/myservice/wcfservice/
3:/Out: Myserviceproxy. CS/config: myserviceproxy. config
4:Microsoft (r) service model metadata Tool
5:[Microsoft (r) Windows (r) Communication Foundation, version 3.0.20.6.648]
6:Copyright (c) Microsoft Corporation. All rights reserved.
7:
8:Attempting to download metadata from'Http: // localhost: 8731/design_time_addresse
9:S/myservice/wcfservice /'UsingWS-Metadata Exchange or disco.
10:Generating files...
11:C: \ Users \ chaks \ Documents \ Visual Studio 2008 \ projects \ myservice \ myservicehost \ MYS
12:Erviceproxy. CS
13:C: \ Users \ chaks \ Documents \ Visual Studio 2008 \ projects \ myservice \ myservicehost \ MYS
14:Erviceproxy. config
Now we can add this. CSFile to the client project and copy
. ConfigFile contents to the client'sApp. configFile and
Execute the client
We can also instruct svcutil to generate the proxy in the preferred language
We want:
1:Svcutil/T: code/Language = VB
2:HTTP:// Localhost: 8731/design_time_addresses/myservice/wcfservice/
3:/Out: Myserviceproxy. Vb/config: myserviceproxy. config
Servicemodel metadata utility (svcutil.exe)
Servicemodel metadata utility is used to generate service model code based on metadata documents and metadata documents based on service model code.
Metadata: used to describe the content, coverage, quality, management method, data owner, and data provision method of elements, datasets, or datasets.
Svcutil Command Options:
- /Async simultaneously generates synchronous and asynchronous method signatures. Default setting: only the synchronous method signature is generated. Abbreviated form:/
- /Config: <Configuration File> specifies the file name for the generated configuration file. Default setting: output. config
- /Out: <File> specifies the file name for the generated code. Default setting: the name of the WSDL definition derived from a schema, the name of the WSDL service, or the target namespace. Abbreviated form:/o