Last post Dec 20, 2016 01:22 PM by firstname.lastname@example.org
Dec 19, 2016 09:23 AM|Intellix|LINK
In an ASP.NET web form application on Framework 4.6 and IIS 8.5, a contradiction is raised and I don't see the solution.
A page is intended to process a long running task. I use then an asynchronous task.
To inform the user of the task progression, I send percentage complete to the browser using websocket.
ASP.NET raises following errors :
- it tells that "WebSockets is unsupported in the current application configuration. To work around this, remove the following configuration switch in Web.config UseTaskFriendlySynchronizationContext".
So I remove the mentionned item from the web.config.
I re-run the page.
- ASP.NET says that "Providing a non-null 'timeoutHandler' or a true 'executeInParallel' parameter value to the PageAsyncTask constructor is unsupported in the current application configuration. To work around this, add the following configuration
switch in Web.config : UseTaskFriendlySynchronizationContext = false"
timoutHandler is well non null and point to a sub in the task and the executeInParallel is set to false...
Here is the code for the asynchronous task definition :
' Define the asynchronuous task.
Dim mytask As New AsyncTask_trim_BR()
mytask.sessionID = Session.SessionID
Dim asynctask As New PageAsyncTask(AddressOf mytask.OnBegin, AddressOf mytask.OnEnd, AddressOf mytask.OnTimeout, DBNull.Value, False)
Are websocket and asynchronous page incompatible ?
Does someone have an idea how to deal with that ???
Dec 20, 2016 01:07 PMemail@example.com|LINK
After searched in google, I suggest you could try below suggestion.
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
To web.config solved the problem
Dec 20, 2016 01:22 PMfirstname.lastname@example.org|LINK
Thank you for reply.
I already tried to set the key
aspnet:UseTaskFriendlySynchronizationContext to true. The result is the same : websocket doesn't want the key.
Finally I solved the problem : when reading carefully the error, it is said "Providing a non-null 'timeoutHandler' is unsupported
" which means : providing a null timeouthandler is supported...
I did that is the instruction, and it is ok now : no more error.
Dim asynctask As New PageAsyncTask(AddressOf mytask.OnBegin, AddressOf mytask.OnEnd, NOTHING, DBNull.value, false)
DAMNED : I re-use by mistake a very old account... I was a baby at this time !!!