5

I have the following line of code that is supposed to call a method to run synchronously(set it and forget it):

public class NotificationClass
{
    public void updateSomething
    {
        Task.Run(() => { base.Channel.SomeMethod(someData); }); 
    }
 }

//WCF Service
public class MyWCFService
{
  public void SomeMethod(Data someData)
  {
       HubClass.SomeMethod(someData);
  }
}

This works just fine when I debug on my local machine but SomeMethod() is never called when the app is deployed to a production server. The production server is an Azure Windows Server 2012 machine running IIS 8.

Does something need to be configured in IIS to get async tasks to work properly? There are no errors being reported in event viewer.

7
  • When I've run into this in the past, I've created a special action/method that doesn't call SomeMethod inside a task. That will allow you to see exactly what's going on and if your results are expected.
    – Steven V
    Commented May 14, 2014 at 17:18
  • @StevenV, I could do that locally but it wouldn't help since everything works ok locally. Since the problem is in production and redeployment is not an option until a fix is found, what other options would you recommend?
    – Bruno
    Commented May 14, 2014 at 18:37
  • If you can't redeploy "until a fix is found", you're in for a rough go of it since you won't know if a fix is actually found until you deploy it. But, when it's happened before to me, it's because of code that will work in local settings (connection strings, credentials, caching connections, web services) but fail when they are outside of the firewall. And ensure you're not eating the exceptions by throwing them into an empty try/catch.
    – Steven V
    Commented May 14, 2014 at 18:42
  • When, if ever, is Channel getting disposed? Commented May 14, 2014 at 19:35
  • Channel is actually a WCF service so I'm not explicitly disposing it anywhere. I updated my code so it makes a little more sense.
    – Bruno
    Commented May 14, 2014 at 19:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.