Reputation: 13
I am considering possible implications of making the change to an ASPX page, of adding the Async Keyword to the page and calling a web method via Async.
<%@ Page Language="C#" Trace="false" AutoEventWireup="true" Async="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>
This is needed in order convert a web service call to use Async - such as
using (MyService service = new MyService())
{
service.SayHelloAsync();
//result = service.SayHello();
}
I have two questions with this - does using the Async keyword pose any danger or cause any issues for the page hits that do not call this web service? Is changing this service call in this proposed way safe, or is there a better way to basically fire off and forget a call like this when you don't need to know if it worked?
Upvotes: 1
Views: 153
Reputation: 6839
You should take a look in this post from Scot Hanselman, that explains how you should use async
with ASP.NET WebForms:
The Magic of using Asynchronous Methods in ASP.NET 4.5 plus an important gotcha
EDIT:
Adding the async
keyword only allows you to use the asynchronous operations in your page, taking advantage of the new async/await
for IO bound operations. This will not affect the app. The way you are doing looks good to me.
Upvotes: 1