WCF- WPF应用 [英] WCF- WPF Application

查看:51
本文介绍了WCF- WPF应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用了您的应用程序及其出色的软件.
它正常工作,但是当我将完整的项目导入到我的项目中时,客户端开始出现有关无端点"的错误,但是主机工作正常.与客户端有什么关系??

i have used your application and its awesome.
it worked properly but when i import your complete project into my project then Client side started giving error about "no end point" but Host is working properly.what to do with Client??

推荐答案

您的客户端必须在Web.config或App.config中包含相同的代码:

Your client must contain a same code in your Web.config or App.config:

<system.servicemodel>
    <bindings>
      <basichttpbinding>
        <binding name="basicHttpEndPointConfiguration" 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" />
          </transport></security>
        </readerquotas></binding>
      </basichttpbinding>
    </bindings>
    <client>
      <endpoint address="http://localhost/YourService.svc">
        binding="basicHttpBinding" bindingConfiguration="basicHttpEndPointConfiguration"
        contract="WCF.IYourService" name="basicHttpEndPointConfiguration" />
    </endpoint></client>
  </system.servicemodel>


//wcf-wpf客户端-宿主项目正常运行,但是当我将此项目导入////到我自己的小项目中时,客户端停止工作并给出异常. 无法在ServiceModel客户端配置部分中找到引用合同" SVC.IChat"的默认终结点元素.这可能是因为没有为您的应用程序找到配置文件,或者是因为在客户元素."

///这是我的app.config文件的样子:


// wcf-wpf client-host project run properly but when i imported this project //into my own small project then client stopped working and give exception.
" Could not find default endpoint element that references contract ''SVC.IChat'' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element. "

/// this how my app.config file is:


 <configuration>
    <system.servicemodel>
        <bindings>
            <nettcpbinding>
                <binding name="NetTcpBinding_IChat" closetimeout="00:01:00" opentimeout="00:01:00">
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false"
                    transferMode="Buffered" transactionProtocol="OleTransactions"
                    hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                    maxBufferPoolSize="67108864" maxBufferSize="67108864" maxConnections="100"
                    maxReceivedMessageSize="67108864">
                    <readerquotas maxdepth="32" maxstringcontentlength="67108864" maxarraylength="67108864">
                        maxBytesPerRead="67108864" maxNameTableCharCount="16384" />
                    <reliablesession ordered="true" inactivitytimeout="20:00:10">
                        enabled="true" />
                    <security mode="None">
                        <transport clientcredentialtype="Windows" protectionlevel="EncryptAndSign" />
                        <message clientcredentialtype="Windows" />
                    </security>
                </reliablesession></readerquotas></binding>
            </nettcpbinding>
        </bindings>
        <client>
            <endpoint address="net.tcp://localhost:7997/WPFHost/tcp" binding="netTcpBinding">
                bindingConfiguration="NetTcpBinding_IChat" contract="SVC.IChat"
                name="NetTcpBinding_IChat" />
        </endpoint></client>
    </system.servicemodel>
</configuration>


这篇关于WCF- WPF应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆