Silverlight CSLA 4 upgrade error from 3 CslaDataProvider

Silverlight CSLA 4 upgrade error from 3 CslaDataProvider

Old forum URL: forums.lhotka.net/forums/t/9949.aspx


JJLoubser posted on Tuesday, January 18, 2011

 CslaDataProvider DPBookingRequest = this.Resources["data"] as CslaDataProvider;

           
            if (DPBookingRequest.CanSave)
            {

               BookingRequestER bookingObject = (BookingRequestER)DPBookingRequest.Data;

              

               if (bookingObject.IsValid)
                   DPBookingRequest.Save();

 

}

 

this save always work in 3, but in 4 gives this error after Begin_Save was call on Csla:

 

{System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid. 
   Check InnerException for exception details.
  
   ---> System.ServiceModel.CommunicationException: The remote server returned an error:
   NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException:
   The remote server returned an error: NotFound.
  
   at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
   at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
   at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
   --- End of inner exception stack trace ---
   at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
   at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
   --- End of inner exception stack trace ---
   at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
   at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
   at Csla.WcfPortal.WcfPortalClient.WcfPortalClientChannel.EndUpdate(IAsyncResult result)
   at Csla.WcfPortal.WcfPortalClient.Csla.WcfPortal.IWcfPortal.EndUpdate(IAsyncResult result)
   at Csla.WcfPortal.WcfPortalClient.OnEndUpdate(IAsyncResult result)
   at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
   --- End of inner exception stack trace ---
   at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
   at Csla.WcfPortal.UpdateCompletedEventArgs.get_Result()
   at Csla.DataPortalClient.WcfProxy`1.proxy_UpdateCompleted(Object sender, UpdateCompletedEventArgs e)}

 

 

 

what is this?

RockfordLhotka replied on Tuesday, January 18, 2011

Based on the exception the issue is with WCF or the data portal, not with the CslaDataProvider control.

Is this a Silverlight or WPF client?

RockfordLhotka replied on Tuesday, January 18, 2011

Sorry, I should have read the subject: Silverlight :)

There are some changes in MobileFormatter from 3 to 4. Also if you moved from SL 3 to SL 4 as part of the process there are some differences in WCF too.

The most common reason for that exception is that the WCF message size limits weren't raised, or that you aren't using compression. Information on both topics is in the FAQ

http://www.lhotka.net/cslanet/faq/DataPortalFaq.ashx

 

JJLoubser replied on Wednesday, January 19, 2011

yes silverlight lol, it make sense, because my other objects are saving/updating they are small objects, this object is large and contain uge information, my Commpressedhost, CommpressedUtility and CommpressedProxy is correct and the rest of the commpression stuff. Check if my web.config section of the webserver is fine:

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="MyBinding" maxBufferSize="10000000" maxReceivedMessageSize="10000000" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00">
            <readerQuotas maxBytesPerRead="10000000" maxArrayLength="10000000" maxStringContentLength="10000000"/>
          <!--<security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows"/>
          </security>-->
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfPortalBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
        <behavior name="EcoBookings.Web.WcfPortalBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
        <behavior name="EcoBookings.Web.AuthenticationBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  

    <services>
      <service behaviorConfiguration="WcfPortalBehavior" name="Csla.Server.Hosts.Silverlight.WcfPortal">
        <endpoint address="" binding="basicHttpBinding" contract="Csla.Server.Hosts.Silverlight.IWcfPortal" bindingConfiguration="MyBinding">
            <identity>
             <dns value="localhost"/>
            </identity>
        </endpoint>
      </service>
    
    </services>

  </system.serviceModel>

 

is it correct? 

JJLoubser replied on Wednesday, January 19, 2011

I update my web.config file to this, but same error:

 

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="CslaAuthentication" value="Custom"/>
  </appSettings>
  <connectionStrings>






  </connectionStrings>

  <system.serviceModel>
   
    <services>
      <service behaviorConfiguration="WcfPortalBehavior" name="Csla.Server.Hosts.Silverlight.WcfPortal">
        <endpoint address="" binding="basicHttpBinding" contract="Csla.Server.Hosts.Silverlight.IWcfPortal" bindingConfiguration="MyBinding">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
      </service>

    </services>

   
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfPortalBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
        <behavior name="EcoBookings.Web.WcfPortalBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
        <behavior name="EcoBookings.Web.AuthenticationBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <bindings>
      <basicHttpBinding>
        <binding name="MyBinding" maxReceivedMessageSize="2147483647">
          <readerQuotas maxBytesPerRead="2147483647"
                        maxArrayLength="2147483647"
                        maxStringContentLength="2147483647"
                        maxDepth="1024"/>

          <!--<binding name="MyBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
                 receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00">
          <readerQuotas maxBytesPerRead="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647"/>-->
         
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>





  </system.serviceModel>
   
 
  <system.web>
    <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.
        -->
    <compilation debug="true" targetFramework="4.0">
    </compilation>

    <httpRuntime maxRequestLength="2147483647"/>

    <authentication mode="Windows"/>
    <!--<authentication mode="None"/>
    <identity impersonate="true" />-->

    <!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->

   
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>

   
   

  </system.web>
  <!--
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
               
    -->
 
       
</configuration>

 

is it something else?

RockfordLhotka replied on Wednesday, January 19, 2011

Look at the config examples in the FAQ and copy them. Your config is generally correct, but you can raise the limits much higher.

And you should use compression. The size of messages will almost always exceed the WCF maximum limits unless you use compression.

JJLoubser replied on Friday, January 21, 2011

I played with all the web.configs and compare my compression classes and other stuff with the examples, it is the same, but still get the error.

this works

<endpoint
                address="http://localhost:1755/WcfSlPortal.svc"
                binding="basicHttpBinding"
                bindingConfiguration="MyBinding"
                contract="WcfPortal.IWcfPortal"
                name="BasicHttpBinding_IWcfPortal" />
         

, but

why is this not working

 

   <!--these are not working:-->
          <!--contract="Csla.WcfPortal.IWcfPortal"-->
          <!--contract="Csla.Silverlight.WcfPortal.IWcfPortal"-->
          <!--contract="Csla.Xaml.WcfPortal.IWcfPortal"-->

 

isnt that the problem, else I have a diffrent problem somewhere, sometimes my dataportal just stop work then I clean and recompile all then i works, sometimes not, ???????????????????

JJLoubser replied on Tuesday, January 25, 2011

we got it fix: the problem was the name of the service, so Rodhkta examples that use commpression should also not work, because our code was exact the same, now it works.

web.config file should look like this:

 

<system.serviceModel>
   
    <services>
      <service behaviorConfiguration="WcfPortalBehavior"                                                       name="Business.Compression.CompressedHost">Stick out tongue
        <endpoint
          address=""
          binding="basicHttpBinding"
          contract="Csla.Server.Hosts.Silverlight.IWcfPortal"
          bindingConfiguration="MyBinding">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
      </service>

    </services>

   
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfPortalBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
        <!--<behavior name="EcoBookings.Web.WcfPortalBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
        <behavior name="EcoBookings.Web.AuthenticationBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>-->
      </serviceBehaviors>
    </behaviors>

    <bindings>
      <basicHttpBinding>
        <binding name="MyBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
                 receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00">
          <readerQuotas maxBytesPerRead="2147483647"
                        maxArrayLength="2147483647"
                        maxStringContentLength="2147483647"
                        maxDepth="1024"/>

         
          <!--<security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows"/>
          </security>-->
        </binding>
      </basicHttpBinding>
    </bindings>





  </system.serviceModel>

 

 

Copyright (c) Marimer LLC