Generate WCF Client using svcutil with nettcpbinding

http://51uu.5d6d.com/viewthread.php?tid=120&extra=

The following is the example of the service configuration that exposing the metadata. I’ve bold the new configurations.

<? xml version = "1.0 "?>

< configuration >

  < system.serviceModel >

    < services >

      < service behaviorConfiguration = "WcfBehavior " name = "WCF.Overpayment.OverpaymentPersistenceService ">

        < endpoint address = "net.tcp://localhost:5000/OverpaymentService "

          binding = "netTcpBinding " bindingConfiguration = "netTcpBindingConf "

          contract = "WCF.Overpayment.IOverpaymentPersistenceService " />

        < endpoint address = "mex " binding = "mexTcpBinding " name = "MEX " contract = "IMetadataExchange " />

        < host >

          < baseAddresses >

            < add baseAddress = "net.tcp://localhost:5000/OverpaymentService " />

          </ baseAddresses >

          < timeouts closeTimeout = "00:00:10 " />

        </ host >

      </ service >

    </ services >

    < bindings >

      < netTcpBinding >

        < binding name = "netTcpBindingConf " transactionFlow = "true " maxReceivedMessageSize = "10000000 ">

          < security mode = "None " />

        </ binding >

      </ netTcpBinding >

    </ bindings >

    < behaviors >

      < serviceBehaviors >

        < behavior name = "WcfBehavior ">

          < serviceDebug includeExceptionDetailInFaults = "true " />

          < serviceMetadata />

        </ behavior >

      </ serviceBehaviors >

    </ behaviors >

  </ system.serviceModel >

</ configuration >

Once you've set up this configuration, you'll be able to use the Visual Studio Command Prompt and type

svcutil net.tcp://localhost:5000/OverpaymentService

 

You should see the following

C:/temp/OverpaymentPersistenceService.cs
C:/temp/output.config

C:/temp>svcutil net.tcp://localhost:5000/OverpaymentService
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.648]
Copyright (c) Microsoft Corporation.  All rights reserved.

Attempting to download metadata from 'net.tcp://localhost:5000/OverpaymentServic
e' using WS-Metadata Exchange. This URL does not support DISCO.
Generating files...
C:/temp/OverpaymentPersistenceService.cs
C:/temp/output.config

 

http://51uu.5d6d.com/viewthread.php?tid=120&extra=

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值