I am supporting an ASP.Net 3.5 web application and users are experiencing a timeout error after 30 seconds when trying to run a report. Looking around the web it seems it's easy enough to change the timeout in the code, unfortunately I'm not able to access the code and recompile. Is there anyway to configure the default for either the web app, the worker process, IIS or the whole machine?
Here is the stack trace up to the point where it's in System.Data in case I'm missing some other problem:
[SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1948826
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4844747
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
System.Data.SqlClient.SqlDataReader.get_MetaData() +83
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +130
System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +162
System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +115
--Edit
There must be something outside the code itself - I've downloaded the database and run it against the same web site installed on a test server and it runs for longer than 30 seconds and returns the report. I've compared the machine.config and web.config files from the .Net directory on the live and test and they seem the same, compared the two IIS setups, also looked at the SQL Server configuration and the only difference is that the live server is clustered on 64bit W2K3 while the test server is on 32bit.
Unfortunately, everything I've read about this in the past says no, can't be controlled via configuration. Which is a bummer.
You cannot set the command timeout from the connection string or some external setting, sorry.
Sometimes a driver will interpret the 'timeout' parameter in the connection string as both Connect Timeout and Command Timeout period, but that is technically a "bug". Gotta love the standards.
The best I know of is you can set a Connection Timeout in the connection string which controls how long ADO will wait while trying to connect to SQL Server and doesn't impact the Command Timeout.
Personally I think there should be a way to change this setting. Assuming the assembly this is in is not strong named your best bet might be to reverse engineer the code modify the source and redeploy the assembly with the new name.
It's not too hard to roll your own though? Just create a custom SqlCommandTimeout setting under AppSettings. If you are already using some sort of SqlCommandFactory to create your SqlCommand or have some sort of SqlCommand base class then you can easily make the change. If not then you probably don't care enough about your code to want to put this in a configuration file anyway.
Regards,
James
Related
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"
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I deployed my asp.net web application on somee.com, whenever I login into this site (ipc.somee.com) it gives me a network related error like:
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: 26 - Error Locating Server/Instance Specified)
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: 26 - Error Locating Server/Instance Specified)
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
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: 26 - Error Locating Server/Instance Specified)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5296071
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +558
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +5308555
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +145
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +920
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +307
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions) +434
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +5311099
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +37
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions) +558
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions) +67
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1052
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +167
System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +143
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +83
System.Data.SqlClient.SqlConnection.Open() +96
Default.log(Object sender, EventArgs e) in c:\users\sreekanth\documents\visual studio 2010\Projects\IPCWebApp\IPCWebApp\Default.aspx.cs:43
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +115
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +124
System.Web.UI.WebControls.ImageButton.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) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
Sql Server fire this error when your application don't have enough rights to access the database. there are several reason about this error . To fix this error you should follow the following instruction.
Try to connect sql server from your server using management studio . if you use windows authentication to connect sql server then set your application pool identity to server administrator .
if you use sql server authentication then check you connection string in web.config of your web application and set user id and password of sql server which allows you to log in .
if your database in other server(access remote database) then first of enable remote access of sql server form sql server property from sql server management studio and enable TCP/IP form sql server configuration manager .
after doing all these stuff and you still can't access the database then check firewall of server form where you are trying to access the database and add one rule in firewall to enable port of sql server(by default sql server use 1433 , to check port of sql server you need to check sql server configuration manager network protocol TCP/IP port).
if your sql server is running on named instance then you need to write port number with sql serer name for example 117.312.21.21/nameofsqlserver,1433.
If you are using cloud hosting like amazon aws or microsoft azure then server or instance will running behind cloud firewall so you need to enable 1433 port in cloud firewall if you have default instance or specific port for sql server for named instance.
If you are using amazon RDS or SQL azure then you need to enable port from security group of that instance.
If you are accessing sql server through sql server authentication mode them make sure you enabled "SQL Server and Windows Authentication Mode" sql server instance property.
Restart your sql server instance after making any changes in property as some changes will require restart.
if you further face any difficulty then you need to provide more information about your web site and sql server .
i am porting a web application to aws. there is an aspx page that collates info from about 15 or 20 different tables data tables from 3 different databases. it is running fine on godaddy shared hosting and also on my dev servers but when i put it on a micro instance ec2 on aws (not sure if that has anything to do with the problem just trying to give as much info as possible) i am getting random errors. i works sometimes but quite often i am getting the following error
Internal connection fatal error at
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler,
SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
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)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
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.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at UtilitiesLib.csharp.CSharpSqlServer.executeQuery(String sqlstring) in X:\code\UtilitiesLibCSharp\CSharpSqlServer.cs:line 87 at UtilitiesLib.data.Database.executeQuery(DataClass obj, String sqlstring)
in X:\code\UtilitiesLibSL\data\Database.cs:line 67
at UtilitiesLib.data.DataClass.loadSQLObject(Database db, DataClass obj, Int32[] cols, String[] signs, String[] vals, String[] ops) in X:\code\UtilitiesLibSL\data\DataClass.cs:line 253
at UtilitiesLib.data.reading.TestBlockItemMathProblem..ctor(Database db, Int32 blockid, Int32 teacherid) in X:\code\UtilitiesLibSL\data\reading\TestBlockItemMathProblem.cs:line 30
at UtilitiesLib.transport.reading.readingTCPCommHandlerClient.getTestBlockItem(Int32 type, Database db, Int32 blockid, Int32 teacherid) in X:\code\UtilitiesLibSL\transport\reading\readingTCPCommHandlerClient.cs:line 325
at reading.test.Page_Load(Object sender, EventArgs e) in X:\code\reading\test.aspx.cs:line 157
sometimes i get a different error that says something to the effect that the connection is already closed.
this is super weird because i have no problem with the site on the shared hosting or on my dev server. the aws machine is running windows 2008 server and iis 7.5 and sql server express 2008 r2. there are other pages in the site that use data tables just fine and never have this error but they are using less less data tables. anyone have any idea what could be causing this?
I think you are hitting the micro instance's 613MB RAM limit. It's probably not enough for Windows Server, IIS, and SQL Server together. A couple of things you might also try: disable connection pooling in the connection string; also, make sure you immediately dispose your connection as soon as the command completes (use using blocks).
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.