AutoGenerate cannot be used in a cluster

Discussion in 'Site Programming, Development and Design' started by 0000677, Oct 19, 2009.

  1. Anyone can help me with this error in my page?
    Thank You.

    Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

    [HttpException (0x80004005): Unable to validate data.]
    System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +289
    System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +140

    [ViewStateException: Invalid viewstate.
    Client IP: 84.228.75.176
    Port: 62183
    User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; InfoPath.1; .NET CLR 3.0.30729)
    ViewState: /wEPDwULLTIwODIzNzQ3NTYPZBYCAgEPZBY4AgEPDxYCHgRUZXh0BRVFbmNyaXB0YWRvciBkZSBUZXh0b3NkZAIDDxBkDxYFZgIBAgICAwIEFgUFB0VuZ2xpc2gFDVBvcnR1Z3XDqnMtQlIFCUZyYW7Dp2FpcwUU0KPQutGA0LDRl9C90YHRjNC60LAFDtCg0YPRgdGB0LrQuNC5FgBkAgUPDxYCHwAFDVBvcnR1Z3XDqnMtQlJkZAIHDw8WAh8ABR1PIHF1ZSDDqSB1bSB0ZXh0byBFbmNyaXB0YWRvPxYCHgdvbmNsaWNrBRZyZXR1cm4gb3BlbkhlbHBQb3J0KCk7ZAIJDw8WAh8ABbYDUGFyYSBpbnZlcnRlciwgZW5jcmlwdGFyIG91IGRlY3JpcHRhciBxdWFscXVlciB0ZXh0byB1c2FuZG8gc2VuaGEgKG3DoXguIGRlIDIwIGNhcmFjdGVyZXMpIC4gQXDDs3MgZW5jcmlwdGFkbywgdW0gdGV4dG8gc8OzIHBvZGVyw6Egc2VyIGxpZG8gbmF2ZWdhbmRvIHBhcmEgbyBsaW5rIGRvIHRleHRvIGVuY3JpcHRhZG8gb3UgY29sYW5kbyBhcXVpIHRvZG8gdGV4dG8gZW5jcmlwdGFkbywgZGlnaXRhbmRvIGEgc2VuaGEgY29ycmV0YSBlIGNsaWNhbmRvIG5vIGJvdMOjbyBwYXJhIGRlY3JpcHRhci4gTyB0ZXh0byBlbmNyaXB0YWRvLCBvdSBvIGxpbmsgZG8gdGV4dG8gZW5jcmlwdGFkbywgc...]
     
  2. FredC

    FredC Winhost Staff

  3. Ray

    Ray

    This error message typically means that your application pool is being recycled. On the Winhost servers there are specific conditions set in place that will recycle the application pool. They are....

    1) More than 20 minutes of idle time (no http request in 20 minutes)
    2) The application uses more than 100 MB memory
    3) The application uses more than 75% of CPU time

    There are two approaches to these problems you will need to undertake. First off, try going through your program and optimize it. The best way to do this is to download your web application in your developement box and run a series of tests. Incorporate these same thresholds I have outlined and use your task manager to monitor the resource usage of your web application.

    The second approach is configuring your viewstate to use a predefined key rather then an auto generatted key that ASP.Net creates. You may want to look at this link for some guidelines on how to do this.

    http://support.microsoft.com/kb/313091/EN-US/
    http://www.aspnetresources.com/tools/keycreator.aspx

    Now remember with the standard ASP.Net web forms typically two things are used. One is the session and the other is viewstate. If this is the case you may also want to consider changing the way you hold sessions for your application to a SQL session. The SQL server is a separate box from the web server. That means if your application pool is recycled, the session should be saved on the server.
     
  4. Hi frankc and Ray. I'm new in ASP.NET but I will visit the links you show me and try to fix my problem with validation key after the application is recycled.
    Thank you very much for you attentions.
     
  5. I am experiencing the same issue. I am certain that I am not exceeding the resource limitations that cause the app pool to restart. I have also included a generated machine key in my web.config. Is there something else I should look at?

    I should probably mention that this is an ASP.NET MVC app.
     
  6. Ray

    Ray

    You can always disable viewstate on your application if you do not need it. If you are loosing your session then most likely your application pool is recycling.
     

Share This Page