CSLA.Net 学习 - WCF服务端与客户端配置

CSLA的wcf配置其实还是很简单的,Csla数据门户支持wcf代理,所以这里使用wcfproxy作为其分布式应用的方法.本文内容参考周大虾文章.

一当初最不理解的,也最想问的就是,服务端和客户端配置了,代码怎么弄?这里可以告诉你,只要你按csla的数据门户规则来办事,代码一句也不用动,你需要了解一下csla的时序图而已,看它什么时候走到服务端了!当然还有一个关键!!!请看下面:

 

服务端主要配置:

 

  <system.serviceModel>

    <services>

      <service name="Csla.Server.Hosts.WcfPortal" behaviorConfiguration="returnFaults">

        <endpoint address="http://localhost:8000/GIX4" binding ="customBinding"

                  bindingConfiguration="compactBindingConfig" contract="Csla.Server.Hosts.IWcfPortal"/>

        <host>

          <baseAddresses>

            <add baseAddress="http://localhost:8000/GIX4"/>

          </baseAddresses>

        </host>

      </service>

    </services>

    <bindings>

      <customBinding>

        <binding name="compactBindingConfig" receiveTimeout="00:20:00" sendTimeout="00:30:00">

          <binaryMessageEncoding>

            <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>

          </binaryMessageEncoding>

          <httpTransport maxReceivedMessageSize="2147483647" />

        </binding>

      </customBinding>

    </bindings>

    <behaviors>

      <serviceBehaviors>

        <behavior name="returnFaults">

          <serviceDebug includeExceptionDetailInFaults="true"/>

          <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false 并删除上面的元数据终节点-->

          <serviceMetadata httpGetEnabled="true"/>

        </behavior>

      </serviceBehaviors>

    </behaviors>

  </system.serviceModel>

 

客户端主要配置:

 

<system.serviceModel>

    <client>

      <endpoint address="http://localhost:8000/GIX4" binding="customBinding"

          bindingConfiguration="compactBindingConfig" contract="Csla.Server.Hosts.IWcfPortal"

          name="WcfDataPortal" />

    </client>

    <bindings>

      <customBinding>

        <binding name="compactBindingConfig" receiveTimeout="00:20:00" sendTimeout="00:30:00">

          <binaryMessageEncoding>

            <readerQuotas maxDepth="64" maxStringContentLength="2147483647"

                          maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />

          </binaryMessageEncoding>

          <httpTransport maxReceivedMessageSize="2147483647"/>

        </binding>

      </customBinding>

    </bindings>

  </system.serviceModel>

 

 

 

客户端关键的地方是在appsettings节中加入:
<add key="CslaDataPortalProxy" value="Csla.DataPortalClient.WcfProxy, Csla"/>

代码都不用动的,试试看吧!
下一步想研究更多的csla的wcf特性,不知道是否有回调等...
人还是要低调一点,知道的也要保留一点,不该我干的事不要太参与,吃力不讨好.
低调做人,高调做事,认真做学问!

你可能感兴趣的:(.net)