wcf怎么写服务的客户端代理接口及配置文件呢
我是先写wcf服务的方法的,写完了以后不会配置服务的客户端代理接口及配置文件了,请问有没有什么规律或者有现成的模板呢?
[解决办法]
楼主可以试试cmd里面的svcutil.exe
如下,使用svcutil.exe指令 svcutil.exe [/n:] /out:
D:\>svcutil /n:http://eric.org,eric.org http://127.0.0.1:8988/calculatorservice/
metadata /out:d:\client.cs
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1]
Copyright (c) Microsoft Corporation. All rights reserved.
Attempting to download metadata from 'http://127.0.0.1:8988/calculatorservice/me
tadata' using WS-Metadata Exchange or DISCO.
Generating files...
d:\client.cs
D:\output.config
+++++++++++++++指令解释++++++++++++++++++++++++++++++++++++
1) /n
/namespace: - A mapping from a WSDL or XML Schema targetNamespace to a CLR namespace. Using the '*' for the targetNamespace maps all targetNamespaces without an explicit mapping to that CLR namespace. Default: derived from the target namespace of the schema document for Data Contracts. The default namespace is used for all other generated types. (Short Form: /n)
2) url
读取WSDL服务定义的链接
3)/out:
输出文件的路径文件名。