Click here to Skip to main content
15,911,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Everyone,

When i execute below mentioned part in sql for sending sms using web service, getting error as The operation timed out. i don't know why this error is coming now. it was working perfectly.

The error I get is:
Error while executing sp_OAMethod Send [SQLSTATE 01000] (Message 0) -2147012894 [SQLSTATE 01000] (Message 0) msxml3.dll [SQLSTATE 01000] (Message 0) The operation timed out [SQLSTATE 01000] (Message 0).

This is the part of the stored procedure where error occurs:
SQL
EXEC @hr = master.dbo.sp_OAMethod @xml, 'Send', NULL, @senddata 
IF @hr <> 0
BEGIN
    EXEC master.dbo.sp_OAGetErrorInfo @xml, @src OUTPUT, @desc OUTPUT
    PRINT 'Error while executing sp_OAMethod Send'
    PRINT @hr 
    PRINT @src --SELECT convert(varbinary(4),@hr) hr, @src [Src], @desc [desc]
    PRINT @desc 
    RETURN 0
END

Please help solve this issue,

Thanks in advance.
Posted
Updated 2-Nov-15 23:42pm
v2
Comments
[no name] 3-Nov-15 6:00am    
How much time it is taking to execute the SP and throwing error.
Vijay Varghese Puthukkara 3-Nov-15 6:13am    
around 25 sec

1 solution

You need to increase Timeoutproperty to get result.

If it is ADO.NET:
C#
SqlCommand command = new SqlCommand();
// Setting command timeout to 120 second(2 minute)
command.CommandTimeout = 120;

If it is EntityFramework:
C#
this.context.CommandTimeout = 120;

Secondly you need to find why your SP/Function is taking time to execute. You can use SQl Server profiler to get exact issue. Please go through below link that will help you to improve performance.
Top 10 steps to optimize data access in SQL Server: Part I (use indexing)[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900