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"/>
Related
My ASP.NET C# website is not starting when deployed to IIS. I followed the steps on this page:
https://www.c-sharpcorner.com/article/access-website-hosted-on-iis/
I also tried to deploy my app as an application as well. The problem I'm hitting is that the app pool eventually stops, and when trying to browse it while restarting the app pool + iis reset I get an error
This site can't be reached
with an error code of ERR_CONNECTION_REFUSED when deployed as a website.
When deployed as a web app, I get the below stack trace error.
I have enabled 32 bit applications in my app pool advanced settings as this is a x86 compiled web app. It has ties to a database that is configured as localhost in the connection settings.
When running my web site through visual studio it runs just fine including the database connection.
When deploying a simple HTML app using the same steps used to deploy my asp.net app, the web spins right up and is even viewable to the outside world (so not a firewall/iis issue).
[BadImageFormatException: Could not load file or assembly 'SolutionsWeb' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +225
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +110
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +22
System.Reflection.Assembly.Load(String assemblyString) +34
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +48
[ConfigurationErrorsException: Could not load file or assembly 'SolutionsWeb' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +725
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +247
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +157
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +226
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +73
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +319
System.Web.Compilation.BuildManager.ExecutePreAppStart() +170
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +820
[HttpException (0x80004005): Could not load file or assembly 'SolutionsWeb' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +688
When researching this in event viewer, the application event logs seem to display my actual issue. This seems to be what i need to resolve. I would appreciate insight as to how i can resolve this issue:
Error:
Faulting application name: w3wp.exe, version: 10.0.17763.1, time stamp: 0xa7ccada2
Faulting module name: clr.dll, version: 4.7.3416.0, time stamp: 0x5cabfd2c
Exception code: 0xc00000fd
Fault offset: 0x0045510d
Faulting process id: 0x2ac4
Faulting application start time: 0x01d55ab8fc19c034
Faulting application path: C:\Windows\SysWOW64\inetsrv\w3wp.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Report Id: 564020d7-d5f1-44d0-b142-8b56239aabee
Faulting package full name:
Faulting package-relative application ID:
Information:
Login failed for user 'IIS APPPOOL\SolutionsWeb'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>]
Event ID: 18456
Qualifiers: 49152
Fault bucket 1336845626185276286, type 1
Event Name: APPCRASH
Response: Not available
Cab Id: 0
Problem signature:
P1: w3wp.exe
P2: 10.0.17763.1
P3: a7ccada2
P4: clr.dll
P5: 4.7.3416.0
P6: 5cabfd2c
P7: c00000fd
P8: 0045510d
P9:
P10:
Like i said, after a little bit, the app pool stops due to the failures and the web goes offline entirely.
Any help is very appreciated. Thank you.
Figured it out... it was my database connection. I had it set to use win auth yet security for my system user was not being granted access. I decided to just add a web user account to access the database and use sql auth, and the error went away. My web site is now online.
I almost hate to ask this since there seem to be piles of variations of this question, but thus far none have helped.
I am trying to stand up an old ASP.Net 2.0 app that worked fine a few years ago (different computer/environment.) I can get the default/main page to display without issues. However, all database calls fail. I can connect to "(localdb)\MSSQLLocalDB" via SSMS (either with windows auth, or the intended app credentials.) Select statements run via SSMS on all tables/views/sprocs without issue (all are thus far empty, but they exist.)
Exception
Server Error in '/' Application.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Error occurred during LocalDB instance startup: SQL Server process failed to start.)
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.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Error occurred during LocalDB instance startup: SQL Server process failed to start.)
Source Error:
Line 64: SqlDataAdapter da = new SqlDataAdapter(sql, connection);
Line 65: DataSet ds = new DataSet();
Line 66: da.Fill(ds);
Source File: c:\{snip}\Page.aspx.cs Line: 66
Stack Trace:
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Error occurred during LocalDB instance startup: SQL Server process failed to start.
)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4876207
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +354
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +90
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +367
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +225
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +431
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.SqlClient.SqlConnection.Open() +122
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +31
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +112
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +287
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +94
ExportProgress.Page_Load(Object sender, EventArgs e) in c:\Users\qamain\Desktop\IDC\code\web\InstructionalDays\ExportProgress.aspx.cs:66
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Version Information: Microsoft .NET Framework Version:2.0.50727.5420; ASP.NET Version:2.0.50727.5459
Connection String
<connectionStrings>
<add name="ConnStr" connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=MyApp;User ID=MyUser;Password=****" providerName="System.Data.SqlClient"/>
</connectionStrings>
Environment
Admin account on Win7 Pro VM, ASP.Net 2.0, SQL (various, see image below)
Debug via VS 2015 Community
I ensured that the .Open statement is indeed getting the expected connection string.
Verified database info
C:\Users\myuser>sqllocaldb info mssqllocaldb
Name: mssqllocaldb
Version: 12.0.2000.8
Shared name:
Owner: MYVM\myuser
Auto-create: Yes
State: Running
Last start time: 2/22/2017 1:33:53 AM
Instance pipe name: np:\\.\pipe\LOCALDB#E36AA52B\tsql\query
SQL Settings via SQL Server 2016 Configuration Manager
IIS Auth settings
These specify the same "myuser" as is the owner of the SQL DB
Event Log
These are the events from a single attempt to hit the page/db. The warning is the same message/exception listed at the top of this post. The SQL error (not too helpful) is repeated all five times (and are as follows.)
Troubleshooting steps
Deleted and recreated DB
Deleted following path items,
C:\Users\myuser\AppData\Local\Microsoft\Microsoft SQL Server Local
DB\Instances
Disabled Firewall to ensure it was not the problem
Recycled/restarted app pool and web site (numerous times)
Set and loadUserProfile and setProfileEnvironment to true in this file, C:\Windows\System32\inetsrv\config\applicationHost.config as indicated here
What on earth have I missed?
I'll leave it to the community if this is worth keeping.
The problem is now resolved, unfortunately, I don't know exactly which step resolved the issue.
I did notice just recently that deleting and recreating the MSSQLLocalDB entry via sqllocaldb.exe dropped access to the application's DB needed (along with its tables/views/etc.) This was odd because, when I tried to recreate it, SQL complained that the db.mdf file was already in the C:\Users\myser folder. I deleted the MDF and LDF files there, and then just recreated the db (contained user, tables, views, sproc) and all is finally working.
Ugh, several days of work later. No offense taken if the community feels this post is extraneous (but perhaps the collection of troubleshooting steps might be worthwhile for others.)
I have a misbehaving 3rd party ASP.NET application that is causing IIS to crash. I can't understand how application that throws a simple, unhandled primary key exception is a sufficient reason to kill the web server process.
I was under the mistaken impression that putting a site in it's own application pool would somehow insulate other sites on the web server from errant behavior. I understand that maybe an application that had run-away resource consumption might kill the entire process, but I don't understand how one vendor's unhandled application exception can be allowed to negatively affect every other site on the web server.
I did some web searches and saw that this may happen if a site repeatedly has issues (default setting 5 times in 5 minutes) but that's not what's happening here. What's happening here is every time this exception happens, which is about once every 3 or 4 days, the whole IIS process aborts and causes a momentary outage of ALL of my sites on this web server.
I may possibly have some obscure setting misconfigured. For the most part, my IIS sites and application pools are configured with default settings and these servers have been up and running for years before this issue started occurring in September.
Any thoughts would be greatly appreciated.
System Particulars:
Windows 2008 R2
IIS 7.5
Patched up to date as of last weekend
Here are parts of the 3 event entries that happen every time this issue occurs:
Application logs an unhandled exception:
An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/2/ROOT
Process ID: 4680
Exception: System.Data.SqlClient.SqlException
Message: Violation of PRIMARY KEY constraint 'PK_st_GlobalSettings'. Cannot insert duplicate key in object 'dbo.st_GlobalSettings'. The duplicate key value is (Options, thread_indexerrunning).
The statement has been terminated.
StackTrace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader()
at Microsoft.ApplicationBlocks.Data.SqlHelperInternal.ExecuteReader(SqlConnection , SqlTransaction , CommandType , String , SqlParameter[] , #XZc )
(rest of stack trace hidden to protect the identity of the application vendor)
IIS logs that there was an unhandled exception:
Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Data.SqlClient.SqlException
Stack:
at Microsoft.ApplicationBlocks.Data.SqlHelperInternal.ExecuteReader(System.Data.SqlClient.SqlConnection, System.Data.SqlClient.SqlTransaction, System.Data.CommandType, System.String, System.Data.SqlClient.SqlParameter[], #XZc)
(rest of stack trace hidden to protect the identity of the application vendor)
Then IIS crashes:
Faulting application name: w3wp.exe, version: 7.5.7601.17514, time stamp: 0x4ce7afa2
Faulting module name: KERNELBASE.dll, version: 6.1.7601.18409, time stamp: 0x5315a05a
Exception code: 0xe0434352
Fault offset: 0x000000000000940d
Faulting process id: 0x1248
Faulting application start time: 0x01d02b4003b1de26
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: 0f2bc4ae-97b4-11e4-ad94-001c23b85f7b
Seems the expected behaviour for unhandled exceptions occuring outside of the request context is to terminate the worker process. So if your third party app is doing some async work for example, and throws an unhandled exception, this will meet the criteria. See https://support.microsoft.com/en-us/kb/911816
for more
I have many server 2012 (IIS 8) that I administer and ALL of them are having this problem starting within 48 hours of installing Microsoft updates this month. I checked my application logs over two years and this error had never existed before this month and the only delta in the environment was January's patches!
It is not IIS error. It seems it is a bad request or something else.
The clue is in :"StackTrace: at System.Data.SqlClient.SqlConnection.OnError"
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)
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.