I have a Windows service which continuously each 10 seconds queries the SQL Server database table, and I also have a web site which also queries the same database table after 25 seconds.
After some time I get exception - server timeout exception has occurred. I went through stack-overflow site and has done the changes to SQL configuration settings but still I got the same exception. What to do?
Stack Trace
at System.Data.SqlClient.SqlConnection.OnError(SqlException
exception, Boolean breakConnection) at
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection) at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() 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.ExecuteReader(CommandBehavior behavior)
at
Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteReader(DbCommand
command, CommandBehavior cmdBehavior) at
Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader(DbCommand
command) at
Microsoft.Practices.EnterpriseLibrary.Data.CommandAccessor1.<Execute>d__0.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at System.Runtime.Remoting.Messaging.Message.Dispatch(Object target, Boolean fExecuteInContext) at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage
msg, Int32 methodPtr, Boolean fExecuteInContext)
Show me the code! timeout exception usually are because you don't close the database connection.
try add the code in the final of algorithm
if (connection.State == System.Data.ConnectionState.Open)
{
connection.Close();
connection.Dispose();
}
If you use to EnterpriseLibrary, try add more time to commandTimeOut
DbCommand dbcommand = database.GetStoredProcCommand("usp_TheStoredProcedureName");
dbcommand.CommandTimeout = 120;
Related
We are getting the below exception in the SQL Server session database. (SQL OLTP state)
System.Web.HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown. ---> System.Web.HttpException (0x80004005): Unable to connect to SQL Server session database. ---> System.Data.SqlClient.SqlException (0x80131904): Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 0.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 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, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
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(CommandBehavior behavior)
at System.Web.SessionState.SqlSessionStateStore.SqlExecuteReaderWithRetry(SqlCommand cmd, CommandBehavior cmdBehavior)
ClientConnectionId:396dbd57-4456-4088-99a5-f29755e08619
Error Number:266,State:2,Class:16
at System.Web.SessionState.SqlSessionStateStore.ThrowSqlConnectionException(SqlConnection conn, Exception e)
at System.Web.SessionState.SqlSessionStateStore.SqlExecuteReaderWithRetry(SqlCommand cmd, CommandBehavior cmdBehavior)
at System.Web.SessionState.SqlSessionStateStore.DoGet(HttpContext context, String id, Boolean getExclusive, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags)
at System.Web.SessionState.SqlSessionStateStore.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags)
at System.Web.SessionState.SessionStateModule.GetSessionStateItem()
at System.Web.SessionState.SessionStateModule.PollLockedSessionCallback(Object state)
at System.Web.HttpAsyncResult.End()
at System.Web.SessionState.SessionStateModule.EndAcquireState(IAsyncResult ar)
at System.Web.HttpApplication.AsyncEventExecutionStep.InvokeEndHandler(IAsyncResult ar)
at System.Web.HttpApplication.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar)
i am trying to install proget on my 2012 server,
i am getting these error, this might be due to error in configuration
Please let me know the integration url and feed url..
Product: ProGet
Version: 5.1.15
System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Configuration'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 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, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteScalar()
at Inedo.Hub.Data.InstalledProduct.g__readDbConfigValue|59_0(String key, <>c__DisplayClass59_0& ) in C:\InedoAgent\BuildMasterTemp\Temp_E80991\Src\src\InedoHubCore\Data\InstalledProduct.cs:line 161
at Inedo.Hub.Data.InstalledProduct.ScrapeFromInstallation(String targetPath) in C:\InedoAgent\BuildMasterTemp\Temp_E80991\Src\src\InedoHubCore\Data\InstalledProduct.cs:line 151
ClientConnectionId:674594c1-dcf5-4bac-9fec-44a7a4756ba3
Error Number:208,State:1,Class:16
The integration URL in the Inedo Hub [config] should be https://my.inedo.com/services/v1.
To change the port ProGet listens on, use the Configuration tab after installing.
If ProGet was not previously successfully installed on this machine, deleting the file at %ProgramData%\Inedo\SharedConfig\ProGet.config will stop Inedo Hub from trying to read data from the database.
When I try to publish my asp.net web service application on IIS7, my application works perfect when debugging with Visual Studio. But, when I try to access my webservice from IIS by typing on browser: http://localhost:port/Service1.asmx and click on the method and then click "Invoke" it gives me this error:
System.Data.SqlClient.SqlException: The SELECT permission was denied on the object 'Marimi', database 'eMagazin', schema 'dbo'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.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)
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 WebService.Service1.GetMarime() in C:\Users\Eduard\Desktop\MaG_beta01\MaG\WebService\Service1.asmx.cs:line 741
My Connection to database in web.Config is :
<connectionStrings>
<add name="connection" connectionString="Data Source=EDUARD-PC\EDD;Initial Catalog=eMag; Integrated Security=True;" providerName="System.Data.SqlClient"/>
</connectionStrings>
and I use as Application Pool the ASP.NET v4.0 Classic
I've searched for the solutions on google but I haven't found anything helpful....
Thank you all in advance...
The Application Pool Identity has no permissions on your database: either do not use integrated security, or create a dedicated user for the appool who has database permissions.
I am facing this error occasionally. When I restart the IIS this problem is resolved. The web server(IIS) has more than 10 sites hosted, so i can't restart it simultaneously.
System.Data.SqlClient.SqlException: Distributed transaction completed. Either enlist
this session in a new transaction or the NULL transaction. at
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean
breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection) at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) 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.ExecuteReader() at MyLibrary.LoadDDList(DropDownList&
curDDL, String strTextField, String strValueField, String strTable, String svarconditional)
Please help me find a solution which preferably doesn't involve restarting IIS.
You have a function called LoadDDList in the MyLibrary class.
This function needs a Try Catch around the ExecuteReader() command.
Try
mySqlCommand.ExecuteReader()
Catch sqlException As SqlClient.SqlException
If sqlException.ErrorCode >= 10 Then
Throw
End If
End Try
In the catch, you want to check for an ErrorCode less than 10. If it's less than 10, then it's just a warning message and you can ignore it. If it's 10 or greater, you need to rethrow it, since it's an actual SQL error (parsing error, invalid table, etc.).
Looking at your stack, this is just a warning and should be ignored. You need to fix your code so you won't crash IIS when you hit this SQL Warning.
I am receiving repeated errors from my asp.net ecommerce web app. I am beginning to suspect an automated malicious probe as this is the twelfth attempt to access ProductId=69 which does not exist (ProductId 69 was removed month ago ). I have not found any info via google and hope someone recognizes this. Here is the log entry.
Page location:
/Product.aspx?ProductId=69
Message: Violation of PRIMARY KEY
constraint 'PK_ShoppingCart'. Cannot
insert duplicate key in object
'dbo.ShoppingCart'. The statement has
been terminated.
Source: .Net SqlClient Data Provider
Method: Void
OnError(System.Data.SqlClient.SqlException,
Boolean)
Stack Trace:
at
System.Data.SqlClient.SqlConnection.OnError(SqlException
exception, Boolean breakConnection) at
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection) at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj) at
System.Data.SqlClient.TdsParser.Run(RunBehavior
runBehavior, SqlCommand cmdHandler,
SqlDataReader dataStream,
BulkCopySimpleResultSet
bulkCopyHandler, TdsParserStateObject
stateObj) 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.InternalExecuteNonQuery(DbAsyncResult
result, String methodName, Boolean
sendToPipe) at
System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at
GenericDataAccess.ExecuteNonQuery(DbCommand
command)
After much observation I conclude that these page requests are bots, probably search engines.
Finally identified this error as a duplicate order attempt.