Related Links

Tasks asynchronously - doesnt run on win server 2008, IIS 7.5

Hi, i have an ASP.NET Web API that is running well on my dev machine (Win 10, IIS Express, VS 2017) When i configure the API to run on the win server 2008, IIS 7.5, i get errors pointing to the points where am running some asynchronous code. Here is how
am running the code.

This code returns the expected results but however, on a Win Server 2k8, i get a big fat stacktrace pointing to System.AggregateException.

"Message":"An error has occurred.","ExceptionMessage":"One or more errors occurred.","ExceptionType":"System.AggregateException","StackTrace":" at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)\r\n at PrintAPI.Services.LabelService.GetLabelVariablesAsync(String
labelFileName)

Am i supposed to configure server 2k8 to run asynchronous code? or what on earth am i doing wrong?

Re: Tasks asynchronously - doesnt run on win server 2008, IIS 7.5

This code is causing the problem. You are spinning up a new thread and calling a synchronous method. The code is not starting a background thread. Remove the async code as you are really making the code less efficient.

Re: Tasks asynchronously - doesnt run on win server 2008, IIS 7.5

while Task.Run is useless the way its used, its probably not the error. the error is probably the PrintEngine is not correctly configured on the server (generally they use a profile, which will not be defined for a service account).

Re: Tasks asynchronously - doesnt run on win server 2008, IIS 7.5

feiyim

Hi, i have an ASP.NET Web API that is running well on my dev machine (Win 10, IIS Express, VS 2017) When i configure the API to run on the win server 2008, IIS 7.5, i get errors pointing to the points where am running some asynchronous code. Here is how
am running the code.

i have a service.

C# 5 introduced a simplified approach, async programming, that leverages asynchronous support in the .NET Framework 4.5 and higher.

You can try to check whether the the .NET Framework 4.5 and higher package have installed on the win server 2008, IIS 7.5.