System.Web.HttpException: Validation of viewstate MAC failed - asp.net

Whenever I perform one particular action in my application I get this following error.
Also:
I only get it on first click, all my subsequent clicks work
I only get it in IE, works fine on Google Chrome
I don't get it on my local workstation, only on Dev/QA server
Its a Web garden environment
Updates
When I get rid of Web Garden, it still throws an error
When I go to the server and try to run the application from there, I don't get the exception
More Updates
I don't see the error with IE version 8.0.6001.18702 anymore
IE versions where I see the error are : 8.0.7601.17514, 8.0.6001.18702IC, 7.0.5730.13
On any version of IE with ChromeFrame 23.0.1271.97 (Official Build 171054), we do not see the issue
Any help would be greatly appreciated!!
System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. ---> System.Web.UI.ViewStateException: Invalid viewstate.
Client IP: XX.XXX.XX.XXXX
Port: XXXX
User-Agent: Mozilla/5.0 (Windows NT 5.1; chromeframe/25.0.1364.97) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22
ViewState: /wEPDwULLTIwMjAzMzA5NzcPZBYCZg9kFgRmD2QWAgIBDxUJNGh0dHA6Ly9zdGV3aWUyOjgwL3NvdmVyYS9zY3JpcHRzL2pxdWVyeS0xLjQuMi5taW4uanM3aHR0cDovL3N0ZXdpZTE6ODAvc292ZXJhL3NjcmlwdHMvanF1ZXJ5LmJnaWZyYW1lLm1pbi5qcy1odHRwOi8vc3Rld2llMTo4MC9zb3ZlcmEvc2NyaXB0cy96ZW5NYXN0ZXIuanMvaHR0cDovL3N0ZXdpZTE6ODAvc292ZXJhL3N0eWxlc2hlZXRzL2dsb2JhbC5jc3MyaHR0cDovL3N0ZXdpZTE6ODAvc292ZXJhL3N0eWxlc2hlZXRzL3plbk1hc3Rlci5jc3M+aHR0cDovL3N0ZXdpZTI6ODAvc292ZXJhL3NjcmlwdHMvanF1ZXJ5LXVpLTEuOC4yLmN1c3RvbS5taW4uanMyaHR0cDovL3N0ZXdpZTI6ODAvc292ZXJhL3NjcmlwdHMvZ3JpZC5sb2NhbGUtZW4uanM1aHR0cDovL3N0ZXdpZTE6ODAvc292ZXJhL3NjcmlwdHMvanF1ZXJ5LmpxR3JpZC5taW4uanMpaHR0cDovL3N0ZXdpZTI6ODAvc292ZXJhL3NjcmlwdHMvanNvbjIuanNkAgEPZBYIAgMPDxYCHghJbWFnZVVybAUcZ3JhcGhpY3MvaWNvbnMvYmFubmVyX3NtLmdpZmRkAgQPZBYCAgEPZBYCZg9kFgICBQ8PFgIeBFRleHQFCVN5c0FkbWluMWRkAgsPZBYGAgIPZBYCAgEPZBYCZg9kF...
--- End of inner exception stack trace ---
at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)
at System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)
at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState)
at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState)
at System.Web.UI.HiddenFieldPageStatePersister.Load()
at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
at System.Web.UI.Page.LoadAllState()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Related

RabbitMQ closing AMQP connection with error {handshake_timeout,frame_header}

We have two dotnet applications that publish and subscribe to RabbitMQ respectively. Our developers tested it locally and they work fine on their workstation (launch through Visual Studio). However, when we build them into container and run them, RabbitMQ logs will show the following error messages:
2022-11-01 09:29:15.998692+00:00 [info] <0.1560.868> accepting AMQP connection <0.1560.868>
2022-11-01 09:31:22.599983+00:00 [error] <0.2112.868> closing AMQP connection <0.2112.868>
2022-11-01 09:31:22.599983+00:00 [error] <0.2112.868> {handshake_timeout,frame_header}
And below is the error message on our dotnet container:
RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable
---> RabbitMQ.Client.Exceptions.PossibleAuthenticationFailureException: Possibly caused by authentication failure
---> RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Library, code=541, text='Unexpected Exception', classId=0, methodId=0, cause=System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer.
---> System.Net.Sockets.SocketException (104): Connection reset by peer
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.BufferedStream.ReadByteSlow()
at System.IO.BufferedStream.ReadByte()
at RabbitMQ.Client.Impl.InboundFrame.ReadFrom(Stream reader, Byte[] frameHeaderBuffer, ArrayPool`1 pool, UInt32 maxMessageSize)
at RabbitMQ.Client.Impl.SocketFrameHandler.ReadFrame()
at RabbitMQ.Client.Framing.Impl.Connection.MainLoopIteration()
at RabbitMQ.Client.Framing.Impl.Connection.MainLoop()
at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
at RabbitMQ.Client.Impl.ModelBase.ConnectionStartOk(IDictionary`2 clientProperties, String mechanism, Byte[] response, String locale)
at RabbitMQ.Client.Framing.Impl.Connection.StartAndTune()
--- End of inner exception stack trace ---
at RabbitMQ.Client.Framing.Impl.Connection.StartAndTune()
at RabbitMQ.Client.Framing.Impl.Connection.Open(Boolean insist)
at RabbitMQ.Client.Framing.Impl.Connection..ctor(IConnectionFactory factory, Boolean insist, IFrameHandler frameHandler, String clientProvidedName)
at RabbitMQ.Client.Framing.Impl.Connection..ctor(IConnectionFactory factory, Boolean insist, IFrameHandler frameHandler, ArrayPool`1 memoryPool, String clientProvidedName)
at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.Init(IFrameHandler fh)
at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.Init(IEndpointResolver endpoints)
at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName)
--- End of inner exception stack trace ---
I have spent two days googling and troubleshooting but I am not a developer myself and couldn't find anything similar to our issue. Any help and guidance would be appreciated.
RabbitMQ version: 3.10.5
Erlang version: 24.3.4
.NET version: 6.0.10
RabbitMQ Client Library version: 6.2.1

What causes SignalR WebSocketException - reached the end of the file?

We are using Microsoft.AspNet.SignalR Version=2.1.1.0 running on Windows Server 2016, IIS 10.
We see the following errors in the server logs -
SignalR.Transports.WebSocketTransport Error: 0 : OnError(1531b342-8587-4082-a027-b57505e29a8d, System.Net.WebSockets.WebSocketException (0x80070026): Reached the end of the file
at System.Web.WebSockets.WebSocketPipe.<>c__DisplayClass9_0.b__0(Int32 hrError, Int32 cbIO, Boolean fUtf8Encoded, Boolean fFinalFragment, Boolean fClose)
What could be the cause of above error?

Creating a proxy instance failed - why this error on Windows server 2012, IIS8 using NHibernate 1.2 and Castle.DynamicProxy 1.1.5?

My company needs to move several web sites from a Windows 2008 server to a Windows 2012 server. Databases: SQL Server 2008 R2 and 2012.
A web site that uses NHibernate 1.2.0.4000 and Castle.DynamicProxy 1.1.5.0 has worked perfectly for a long time. Application Pool set to .NET Framework v2.0 og Classic Mode. On the new server we get this error at first attempt to create a persistent object:
Application_Error: UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko - Name: InternetExplorer - Version: 11.0 - UserHostAddress: xxx.xxx.xxx.xxx - Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Reflection.Emit.TypeBuilder._TermCreateClass(Int32 handle, Module module)
at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
at System.Reflection.Emit.TypeBuilder.CreateType()
at Castle.DynamicProxy.Builder.CodeBuilder.AbstractEasyType.BuildType()
at Castle.DynamicProxy.Builder.CodeBuilder.AbstractEasyType.BuildType()
at Castle.DynamicProxy.Builder.CodeGenerators.BaseCodeGenerator.CreateType()
at Castle.DynamicProxy.Builder.CodeGenerators.ClassProxyGenerator.GenerateCode(Type baseClass, Type[] interfaces)
at Castle.DynamicProxy.Builder.DefaultProxyBuilder.CreateClassProxy(Type theClass, Type[] interfaces)
at Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type baseClass, Type[] interfaces, IInterceptor interceptor, Boolean checkAbstract, Object[] argumentsForConstructor)
at NHibernate.Proxy.CastleProxyFactory.GetProxy(Object id, ISessionImplementor session)
Message: Creating a proxy instance failed- Source: NKU.Model- TargetSite: System.Object Get(System.Type, System.Object)-
StackTrace:
at NKU.Model.VZBaseDataAccess.Get(Type type, Object id) in C:\Visual Studio 2008\Projects\NKU.Model\NKU.Model\VZBaseDataAccess.cs:line 181
at ASP.global_asax.Session_Start(Object sender, EventArgs e) in c:\inetpub\wwwroot\NKUWeb\Global.asax:line 113
at System.Web.SessionState.SessionStateModule.RaiseOnStart(EventArgs e)
at System.Web.SessionState.SessionStateModule.CompleteAcquireState()
at System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
For me the following thing worked:
In IIS go to your application pool and select the advanced settings. There you will find a feature (General) 'Enable 32-Bit Applications'. Choose 'True'.
Give a try.

cant run web app on server - runs fine in Debug - permissions problem?

Trying to get a web app to work. Works fine when debugging (in release and Debug mode) but when I publish to a webserver I hit an error when trying to access a local file..
"
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.IO.IOException: Logon failure: unknown user name or bad password.
"
"Stack Trace:
[IOException: Logon failure: unknown user name or bad password.
]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +7717304
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +1162
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) +65
System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) +87
System.IO.StreamReader..ctor(String path) +30
ASP_FSR.SmokeBooks.GetSmokeBookList(String configlocation) in C:\ASP_TEST\ASP_FSR\ASP_FSR\SmokeBooks.cs:39
ASP_FSR.Foundry_Data.getData(String report, String smokeconfig) in C:\ASP_TEST\ASP_FSR\ASP_FSR\Foundry_Data.cs:36
ASP_FSR.Check.RunCheck() in C:\ASP_TEST\ASP_FSR\ASP_FSR\Check.cs:49
ASP_FSR._Default.Button1_Click(Object sender, EventArgs e) in C:\ASP_TEST\ASP_FSR\ASP_FSR\Default.aspx.cs:65
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
"
I have added the user ASP.NET Machine Account (\ASPNET) to the directory where the files are (which is the same as the app)
When you run a webapp in IIS, it is the user that the AppPool runs under that matters.
This varies, so check out the settings IN IIS, and assign permissions for this account instead to the relevant folders.
http://www.advancedinstaller.com/user-guide/iis-app-pool-identity.html
Clearly this is a permission issue. If you are certain the ASP.NET account is configure correctly then are you doing any identity impersonation in web.config i.e. <identity impersonate="true" userName=... and if so is this account configured correctly?
It seems like that your application is trying to access file(s) in the failure. Are you sure you gave the app write/read permission for the file in IIS?
Late response but was back looking at this site and though I should update for anyone with similar issues.
Yes this was a permissions issue. As mentioned by Barry I needed to impersonate the logon for the server account to access temp dir's etc.

Error while clicking linkbutton in MasterPage

I am getting following error.
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that 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 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:
Add a "Debug=true" directive at the top of the file that generated the error. Example:
or:
2) Add the following section to the configuration file of your application:
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:
[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +2546780
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +214
[ViewStateException: Invalid viewstate.
Client IP: 127.0.0.1
Port:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.2; .NET CLR 2.0.50727)
ViewState: 9xQG6dYJ5zq2jCqMiucYRNTojwFlEGYjCH2OQX2PsmFzIZhHtD11AD5JBQmMuoIw105QqG46Ew4o8mVXLBG+T9hl2qqjTTQ/jlivQHaLBjR/cojc5VTk2aZUCmDSZBt/z1yzV8kJLFYrNmIkKAztL+eeZho/zZmCVfRAIcCyhIc=
Referer: http://localhost:1124/Login/ApproveAppointments.aspx
Path: /Login/ApproveAppointments.aspx]
[HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that 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) +116
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +251
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() +220
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +83
System.Web.UI.Page.LoadAllState() +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +154
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.login_approveappointments_aspx.ProcessRequest(HttpContext context) +29
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
I tried the code that given in Source error.But could nt solve.Can anybody help?
Ensure you have put the same machine key in the web.configs on all your machines in the cluster e.g.
<machineKey validationKey="AAABBBCCCDDD111222333444AAABBBCCCDDD111222333444AAABBBCCCDDD111222333444" decryptionKey="AAABBBCCCDDD111222333444" validation="SHA1"/>

Resources