I am into a weird situation that I am facing
I have a SQL database hosted on Azure, PaaS.
Now, the data is queried through a stored procedure with one or multiple search parameters, like EmployeeNo
, Email
etc,
The stored procedure is working fine, as tested, with both parameters. And, is working fine in production as well.
But, what happens is that all of a sudden, in the middle of a day or night, it fetches data through EmployeeNo
, but refuses to fetch through Email
, throwing an erro:
500 Internal Server Error
Interestingly, what works for me is:
Changing the Encryption Enabled
to true
and vice versa
Why is it happening so..?
Can anybody help..
Edit: The database and the calling API are both hosted on Azure. And, when the concerned procedure is run via SSMS it runs perfect, as said before. The problem seems recurrent.
Edit -2 : As per the comments the error I see in the logs is
Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
But, I do have increased the CommandTimeout
to 90
in my code, just in case
Full exception is like :
Exception Message: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Inner Exception: System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out Stack Trace: 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, 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.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader() at VL.SJ.EMDM.Data.DataProvider.EmployeDataProvider.GetEmployeeDetails(SearchEmployee searchEmployee) at VL.SJ.EMDM.Web.API.Controllers.EmployeeController.GetEmployeeDetails(SearchEmployee searchEmployee) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.<ExecuteAsync>b__4() at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func
1 func, CancellationToken cancellationToken)
User contributions licensed under CC BY-SA 3.0