17 Replies Latest reply on Feb 21, 2012 5:32 PM by MvanderVeeken

    Increasing the amount of values PIWebServices can retrieve?

    chris_capula

      Hi All,

       

      I was wondering if it is possible to increase the amount of values PIWebServices can return using 'PIArcDataRequest'

       

      At present, it appears it can handle around 900 values but I am looking at wanting up to around 20,000 if possible, which would be about a years worth of data,

       

      The errors I am recieving for a very simple siverlight test application is:

       

      5001.WebService-Error.png

       

      I have also had a look at the webconfig file within the PIWebServices directory and have added in a MaxRecievedMessageSize for my basichttpbinding and it then doesnt return me any data.What I have included is shown below;

       

      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="basicBindingConfig" maxReceivedMessageSize="131072" >
            </binding>
          </basicHttpBinding>

       

       I guess I am either missing something quite clear, or it may not be possible, but any help is very much appreciated,

       

      Many Thanks

       

      Chris

       

       

        • Re: Increasing the amount of values PIWebServices can retrieve?
          MvanderVeeken
          This is a generic WCF 'issue'. Try the following:
          • The MaxReceivedMessage size property is configured in bytes. So in your config you are talking about 131kb. Which could be less than the size of the message you are trying to transport.
          • You also have to make sure you are referencing the 'basicBindingConfig' in your endpoint configuration (PI Web Services web.config).
          • Try also adjusting the 'maxBufferSize', 'maxBufferPoolSize' and the readerQuotas (PI Web Services web.config)
          • Make sure the values are equal in both the server side config (web.config) and the client config (app.config for a windows application, web.config for an ASP.NET application, or equal in Silverlight)

           

            • Re: Increasing the amount of values PIWebServices can retrieve?
              chris_capula

              Thanks for the response Michael,

               

              I have tried those suggestions however I did come across a few problems - although not sure if what I did was correct.

               

              point 3 - in the PIWS web.config file I have added maxRecievedMessageSize, maxBufferPoolSize and maxBufferSize to my binding as shown below as all I had there originally was the binding name, with regards to the readerQuotas, when I added this to the same line my webservice complained and didnt like it so I had to remove it. so what I was left with is: 

               

                <bindings>
                  <basicHttpBinding>
                    <binding name="basicBindingConfig"  maxBufferPoolSize="1048600" maxReceivedMessageSize="130000" maxBufferSize="130000">
                    </binding>
                  </basicHttpBinding>

               

              Am I putting the max sizes in the right place or do they belong in another part of the web.config file?

               

              point 4 - I am using silverlight - Do I add these to the serviceReferences.clientconfig? little confused by the 'equal in Silverlight' comment.

               

               

               

              Many thanks

               

              Chris

                • Re: Increasing the amount of values PIWebServices can retrieve?
                  dweiner

                  Hi Chris -

                   

                  Although I haven't worked with SilverLight I just though I'd share a few thoughts.  My approach has been to modify ONLY the maxReceivedMessageSize while leaving the maxBufferPoolsize at the default value of 524288 and as originally installed. I've had reliable results doing this, as I suspect that the actual buffering is managed in a different scope.  

                   

                  Also, I have never encountered the appearance of 'maxBufferSize' explicitly stated in the binding so perhaps this could/should be removed.

                   

                  And finally, yes there is a companion value that is to be set at the client-side (in my case it's app.config) so you'll probably do well to address this in the serviceReferences.clientconfig file - but again I'm just guessing there :-)

                   

                  Hope this helps -

                   

                  Dan.

                  • Re: Increasing the amount of values PIWebServices can retrieve?
                    MvanderVeeken

                    The readerQuotas is a seperate element on the binding. Example:

                     

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

                    I'm sorry about the confusion regarding the 'equal in Silverlight' comment, by that I meant the servicereference.Clientconfig. If you have the updated web.config, and you update your ServiceReference in Visual Studio, the new settings should be reflected in your config. They should be equal to the settings on the server side.

                     

                    Please try setting the maxReceivedMessageSize, maxBufferSize and maxBufferPoolSize to a bigger value. If you want to retrieve 20.000 values, I'm not sure how large the message will be. 

                     

                    20.000 value elements (XML) / 130.000 bytes leaves 6.5 bytes per value (without the rest of the message 'overhead'). Even with retrieving only 900 values that would leave 144 bytes per value (without the rest of the message overhead).

                     

                     

                      • Re: Increasing the amount of values PIWebServices can retrieve?
                        chris_capula

                        I am still having no luck with this unfortunatly.

                         

                        I changed just the maxRecievedMessageSize and had no joy, and I have also tried adding the readerQuotas, but again no joy. The thing that concerns me at the moment though is that if I change my web.config file for piwebServices server side and I update my service reference in silverlight I don't get any of the changes shown in my sr.clientconfig file.

                         

                        Many Thanks

                         

                        Chris

                          • Re: Increasing the amount of values PIWebServices can retrieve?
                            MvanderVeeken

                            From what I can understand, there is no 'maxreceivedmessagesize' in your servicereferences.clientconfig?

                             

                            Please edit them in manually, it should look something like this:

                             

                             <bindings>
                               
                            <basicHttpBinding>
                                 
                            <binding name="largeMessageSizeBinding" maxBufferSize="2147483647"
                                     
                            maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
                                   
                            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                                     
                            maxArrayLength="2147483647" maxBytesPerRead="2147483647"
                                     
                            maxNameTableCharCount="2147483647" />
                                   
                            <security mode="Transport" />
                                 
                            </binding>
                               
                            </basicHttpBinding>
                             
                            </bindings>

                            and then make sure you set your bindingConfiguration on your binding element to bindingConfiguration="largeMessageSizeBinding"
                            Can you post your servicereferences.clientconfig just to make sure?

                              • Re: Increasing the amount of values PIWebServices can retrieve?
                                chris_capula

                                I have made the changes again, and I am still getting an error regarding maximum message size is 65536, yet I cannot find a reference to this value anywhere.

                                 

                                I have applied the above web.config file changes, and updated my servicereference.

                                 

                                my serviceReference.clientconfig file reads as:

                                 

                                 

                                 

                                <configuration>

                                 

                                    <system.serviceModel>

                                 

                                        <bindings>

                                 

                                            <basicHttpBinding>

                                 

                                                <binding name="BasicEndpoint" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">

                                 

                                                    <security mode="None" />

                                 

                                                </binding>

                                 

                                            </basicHttpBinding>

                                 

                                            <customBinding>

                                 

                                                <binding name="CustomBinding_AFService">

                                 

                                                    <binaryMessageEncoding />

                                 

                                                    <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />

                                 

                                                </binding>

                                 

                                            </customBinding>

                                 

                                        </bindings>

                                 

                                        <client>

                                 

                                            <endpoint address="http://localhost:3549/AFService.svc" binding="customBinding"

                                 

                                                bindingConfiguration="CustomBinding_AFService" contract="AFService.AFService"

                                 

                                                name="CustomBinding_AFService" />

                                 

                                            <endpoint address="http://ukpnappserver/PIWebServices/PITimeSeries.svc"

                                 

                                                binding="basicHttpBinding" bindingConfiguration="BasicEndpoint"

                                 

                                                contract="PIWebService.IPITimeSeries" name="BasicEndpoint" />

                                 

                                        </client>

                                 

                                    </system.serviceModel>

                                 

                                </configuration>

                                 

                                 

                                 

                                Thanks again 

                                  • Re: Increasing the amount of values PIWebServices can retrieve?
                                    Ahmad Fattahi

                                    Just to confirm, have you adjusted the application’s app.config file (which gets converted to program.exe.config when you build) already?

                                      • Re: Increasing the amount of values PIWebServices can retrieve?
                                        MvanderVeeken

                                        Ahmad

                                        Just to confirm, have you adjusted the application’s app.config file (which gets converted to program.exe.config when you build) already?

                                         

                                        The config he posted is his client config, but in Silverlight this is servicereferences.clientconfig, and it gets packed with the .xap file. There is no (real) Silverlight equivalent to app.config

                                          • Re: Increasing the amount of values PIWebServices can retrieve?
                                            chris_capula

                                            I am still having problems with this issue, I have altered my web.config file on the server and can successfully get up to 800 data points still from the application, but even though I have increased the maxRecievedMessageSize it is still complaining that the limit is 65536.

                                             

                                            Does anyone know of another reason why this may still be happenning? Or has anybody else had difficulties in changing this value and getting it to work?

                                             

                                            Many Thanks All,

                                              • Re: Increasing the amount of values PIWebServices can retrieve?
                                                MvanderVeeken

                                                I'm currently travelling, but I will be sure to create a sample application to try to reproduce your issue.

                                                 

                                                To be sure: you are using PI Web Services, in combination with Silverlight (which version are you using)? You are using PIArcDataRequest to retrieve +900 values, at which point it fails with an exception about MaxReceivedMessage size.

                                                  • Re: Increasing the amount of values PIWebServices can retrieve?
                                                    chris_capula

                                                    Hi Michael,

                                                     

                                                    That would be great thanks. Just to confirm I am using PI Web Services 2010 with Silverlight 5, and using PIArcDataRequest. And yes, it keeps failing with exception about MaxRecievedMessageSize referring to Max size of 65536.

                                                     

                                                    Many Thanks

                                                      • Re: Increasing the amount of values PIWebServices can retrieve?

                                                        Chris, willing to try something?  Remove the "Name" parameter from your binding node, and then remove the bindingConfiguration parameter from your endpoint node.

                                                         

                                                        <configuration>

                                                         

                                                           <system.serviceModel>

                                                         

                                                               <bindings>

                                                         

                                                                   <basicHttpBinding>

                                                         

                                                                       <binding maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">

                                                         

                                                                           <security mode="None" />

                                                         

                                                                       </binding>

                                                         

                                                                   </basicHttpBinding>

                                                         

                                                                   <customBinding>

                                                         

                                                                       <binding name="CustomBinding_AFService">

                                                         

                                                                           <binaryMessageEncoding />

                                                         

                                                                           <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />

                                                         

                                                                       </binding>

                                                         

                                                                   </customBinding>

                                                         

                                                               </bindings>

                                                         

                                                               <client>

                                                         

                                                                   <endpoint address="http://localhost:3549/AFService.svc" binding="customBinding"

                                                         

                                                                       bindingConfiguration="CustomBinding_AFService" contract="AFService.AFService"

                                                         

                                                                       name="CustomBinding_AFService" />

                                                         

                                                                   <endpoint address="http://ukpnappserver/PIWebServices/PITimeSeries.svc"

                                                         

                                                                       binding="basicHttpBinding"

                                                         

                                                                       contract="PIWebService.IPITimeSeries" name="BasicEndpoint" />

                                                         

                                                               </client>

                                                         

                                                           </system.serviceModel>

                                                         

                                                        </configuration>

                                                          • Re: Increasing the amount of values PIWebServices can retrieve?
                                                            chris_capula

                                                            Hi Rhys, I removed both of them but still no joy. I could still pull out up to 900 values, but once I go above 1000 it still complains that that i have exceeded maxRecievedMessageSize of 65536.

                                                             

                                                            Just on your note as well, I stuck with the name theme, and on the web.config file on the server, I removed the service endpoint name of name='basicendpoint' which when I updated my serviceReference it gave me:

                                                             

                                                            <endpoint address="http://ukpnappserver/PIWebServices/PITimeSeries.svc"

                                                             

                                                                           binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IPITimeSeries"

                                                             

                                                                           contract="PIWebService.IPITimeSeries" name="BasicHttpBinding_IPITimeSeries" />

                                                             

                                                            which I thought looked more promising but still no Joy.

                                                             

                                                            Thanks

                                                             

                                                            Chris

                                                              • Re: Increasing the amount of values PIWebServices can retrieve?
                                                                MvanderVeeken

                                                                So, I finally got around to playing a bit more with this issue.

                                                                 

                                                                I've created a very simple Silverlight application that uses the GetPIArchiveValues call. 

                                                                 

                                                                The first thing I'm noticing is that I have no issue at all in getting +25K values in a single call, even with all the default settings. 

                                                                 

                                                                0474.sl_5F00_maxReceivedMsgSize.png

                                                                 

                                                                Here is a link to that sample code. Have a go with it. On the server side I'm using the default 'web_all_bindings_basic.config' example file from the Help\Samples folder. Easiest for you could be to replace my server name ('ultralisk') with yours, or delete and re-add the service reference.

                                                                 

                                                                You can add multiple tag paths in the paths textbox, by separating them with a semicolon ';'. In the above sample I'm using cdt158, sinusoid and sinusoidu

                                                                  • Re: Increasing the amount of values PIWebServices can retrieve?
                                                                    chris_capula

                                                                    Michael,

                                                                     

                                                                    Thank you very much for the application link, it certainly did work with the default values on mine also. Your code behind method was a little different to mine and straight away it pointed out the error I have been making - So very grateful indeed, if not slightly embarrassed by the error.

                                                                     

                                                                    The error I made (incase others make the same error and come across this issue) is within my code behind, I declared a new basicHttpBinding as shown below;

                                                                     

                                                                       EndpointAddress endPointAdd = new EndpointAddress("http://ukpnappserver/PIWebServices/PITimeSeries.svc");
                                                                                BasicHttpBinding basicHttpBinding = new BasicHttpBinding();

                                                                     

                                                                                PITimeSeriesClient client = new PIWebService.PITimeSeriesClient(basicHttpBinding, endPointAdd);

                                                                     

                                                                                client.GetPIArchiveDataCompleted += new EventHandler<GetPIArchiveDataCompletedEventArgs>(client_GetPIArchiveDataCompleted);

                                                                     

                                                                     

                                                                     

                                                                    With this declared, it seems it was then using a default value of 65536 and this was overwriting any changes I made to the web.config and servicereference. so by adding one simple line of code:

                                                                     

                                                                    basicHttpBinding.MaxReceivedMessageSize = 2147483647;

                                                                     

                                                                     

                                                                     

                                                                    then it uses this value instead and the application works fine and pulls out 000's of values.

                                                                     

                                                                     

                                                                     

                                                                    Many thanks all for all the help on this issue, and I only hope that this helps others in the future(should they be so silly)

                                                                     

                                                                    Chris