YAF.NET runtime errors

Discussion in 'Third-party applications' started by Zilog80, Jan 30, 2011.

  1. Hi!
    I was playing with YAF.NET (YesAnotherForum.NET) in my Winhost site and randomly i received this message:

    Server Error in '/forum' Application.
    --------------------------------------------------------------------------------

    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.

    Source Error:

    The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

    1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

    <%@ Page Language="C#" Debug="true" %>

    or:

    2) Add the following section to the configuration file of your application:

    <configuration>
    <system.web>
    <compilation debug="true"/>
    </system.web>
    </configuration>

    Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

    Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

    Stack Trace:


    [ViewStateException: Invalid viewstate.
    Client IP: 181.130.165.196
    Port: 49227
    User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; CMNTDF; InfoPath.2; .NET4.0C; .NET4.0E)
    ViewState: /wEPDwULLTEwODQ3NjY2NDkPZBYCAgUPZBYCAgEPZBYGAgEPZBYCZg9kFgQCAQ8PZBYGHglvbmtleWRvd24FtQFpZihldmVudC53aGljaCB8fCBldmVudC5rZXlDb2RlKXtpZiAoKGV2ZW50LndoaWNoID09IDEzKSB8fCAoZXZlbnQua2V5Q29kZSA9PSAxMykpIHtkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnZm9ydW1fY3RsMDFfZG9RdWlja1NlYXJjaCcpLmNsaWNrKCk7cmV0dXJuIGZhbHNlO319IGVsc2Uge3JldHVybiB0cnVlfTsgHgdvbmZvY3VzBTlpZiAodGhpcy52YWx1ZSA9PSAnU2VhcmNoIEtleXdvcmQuLi4nKSB7dGhpcy52YWx1ZSA9ICcnO30eBm9uYmx1cgU5aWYgKHRoaXMudmFsdWUgPT0gJycpIHt0aGlzLnZhbHVlID0gJ1NlYXJjaCBLZXl3b3JkLi4uJzt9ZAIDDw8WAh4EVGV4dAVXPGltZyBhbHQ9IkJ1c2NhciIgdGl0bGU9IkJ1c2NhciIgc3JjPSIvZm9yby9UaGVtZXMveWFmdmlzaW9uL2ljb25fc2VhcmNoLnBuZyIgLz4gQnVzY2FyZGQCAw8PFgIeBVRpdGxlBQVBdmlzbxYEHgV0aXRsZQUFQXZpc28eBXN0eWxlBQ1kaXNwbGF5Om5vbmU7ZAIED2QWBGYPFgIeClBhZ2VMaW5rRFQy/QsAA...]

    [HttpException (0x80004005): 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.]
    System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106
    System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState) +14
    System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +237
    System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
    System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37
    System.Web.UI.HiddenFieldPageStatePersister.Load() +207
    System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +105
    System.Web.UI.Page.LoadAllState() +43
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
    System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
    System.Web.UI.Page.ProcessRequest() +80
    System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
    System.Web.UI.Page.ProcessRequest(HttpContext context) +49
    ASP.default_aspx.ProcessRequest(HttpContext context) +4
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75




    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4209


    As i said, the error occurs randomly.
    Im using 1.9.5 YAF.NET version

    Any idea to fix this error?
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    We host each website in its unique application pool / process. To conserve memory, we recycle the application if any of the following condition is met

    1) More than 20 minutes of idle time (no http request in 20 minutes)
    2) The application uses more than 100 MB memory for Basic plan or 200 MB memory for Max & Ultimate plan
    3) The application uses more than 75% of CPU time

    If you do not need viewstate I also suggest you disable it. But this will not solve your problem with your application pool being recycled. The best solution to this is optimizing your application so that it does not reach any of these thresholds.
     
  3. Thx for reply Ray

    Two questions:
    1 .- What do you mean with 'viewstate'?
    2 .- How / where i disable it?

    About your 3 points:
    1) I get the error just after install YAF on /forum app. So, its impossible the 20 min idle time.
    2 & 3 ) A 'fresh' installation of YAF (with no data on SQL DB) use 100 MB (i got Basic plan) and / or 75% CPU time on Winhost servers?
    I will not imagine how much RAM and CPU time will use YAF when manage a large amount of users and thousdands of post y DB :confused:

    Googling a bit i just noticed that some other YAF's users got the same issue (not in Winhost hosting)

    Well, i will try investigate a bit.

    Best regards.
     
    Last edited by a moderator: Oct 14, 2015
  4. Ray

    Ray

Share This Page