WCF的一些配置

来源:互联网 发布:黄晓明身高知乎 编辑:程序博客网 时间:2024/06/08 04:10

<span style="font-size:14px;"><strong>本功能是,访问一个PHP写的接口,用WCF配置客户端,来访问放接口</strong></span>    <system.serviceModel>        <bindings>            <basicHttpBinding>                <binding name="DMdeliverySoapAPIBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>                    <security mode="Transport">                        <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>                        <message clientCredentialType="UserName" algorithmSuite="Default"/>                    </security>                </binding>                <binding name="DMdeliverySoapAPIBinding1" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>                    <security mode="None">                        <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>                        <message clientCredentialType="UserName" algorithmSuite="Default"/>                    </security>                </binding>            </basicHttpBinding>        </bindings>        <client>            <endpoint address="https://vv.example.com/x/soap-v6/server.php" binding="basicHttpBinding" bindingConfiguration="DMdeliverySoapAPIBinding" contract="DMDeliverySoapAPI.DMdeliverySoapAPIPort" name="DMdeliverySoapAPIPort"/>        </client>    </system.serviceModel>    <startup>            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

C#写法

static DMDeliverySoapAPI.DMdeliverySoapAPIPortClient client = new DMDeliverySoapAPI.DMdeliverySoapAPIPortClient();

然后就可以使用client.来调用该接口中的方法了



0 0
原创粉丝点击