none
Duplex channel not working with IIS hosted WCF service RRS feed

  • Question

  • Hello,

    I have a WCF Service A in a .NET Executable and a Web Service B hosted in IIS.

    The Web service B is passing a callback method via a duplex service contract to the WCF service A in the .net executable.

    Than the WCF service a is using the callback to notify the IIS hosted service B.

    This works fine running IIS on Windows 7.

    When we put that binaries to a Windows Server 2008 R2, the communication from IIS Service B to

    WCF Service A works fine, but as soon as the callback on A is called, it seems that the whole Application in the IIS is restartet or that a new app domain is created in IIS, I am not sure.

    The fact is, that the singleton variables which have valid references before are null in the callback and therefore are instanciated new.

    Of course this is not what we want.

    Does any body have a hint what's going on and how we can fix it?

    We are using wsHttpDualBinding for the callback interfaces.

    Thank you

    RB

    Tuesday, April 30, 2013 10:28 AM

All replies

  • Hi, do you mean all works ok at Win 7, but when put those things( both service A and service B) in Windows Server 2008 R2, there be an issue?

    It is hard to get what is the specific issue is from your description, do you try turn on tracing for your service to inspect is there any error message?

    http://msdn.microsoft.com/en-us/library/ms733025.aspx

    Wednesday, May 1, 2013 3:21 AM
  • Hello Nico_he,

    thank you for your answer.

    Yes, I mean moving everything to Server 2008 R2 and yes, I agree it is an Abstract description of the Problem and hard to get.

    We have implemented our own tracing and after the Duplex callback to IIS Service, the log file is recreated and starts logging as it does when the IIS based Service is initialized the first time.

    That means, either the iis application is restarted, or a new app Domain is created, which is what we do not understand.

    We see no error Messages nor xceptions.

    Could it be a security issue with the wsHTTPDualBinding context?

    What do you Need to understand the Problem better?

    Thank you

    RB

    Wednesday, May 1, 2013 9:07 AM
  • Hi RB,

    Since you directly move the compiled service from win7 machine to the 2008 r2 server, so the code base/binary is not changed. The problem should be environment specific. As you mentioned that the server is restarted when the callback is invoked, how did you get that? Usually, an IIS hosted web application/service app restart (or the process recycled) means that there is some unhandled exception occurs which cause the original process be terminated. You can check the server's event log to see if there is any application error log indicate such process termination.

    In order to get more details about the problem, I'd suggest you consider the following means:

    1) If possible, you can directly us Visual Studio to perform debugging against the IIS worker process (hosting your WCF service which encounter problem). Need to install remote debugging component on server

    http://www.codeproject.com/Articles/38132/Remote-IIS-Debugging-Debug-your-ASP-NET-Applicatio

    2) WCF provides built-in tracing and message logging feature. You can turn on them via app.config (web.config for web app). You can enable tracing for your IIS hosted WCF service to see if it can provide more information about this problem.

    #Using Tracing to Troubleshoot Your Application
    http://msdn.microsoft.com/en-us/library/aa738639.aspx

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, May 2, 2013 8:59 AM
    Moderator
  • Hello Steven,

    thank you for your answer.

    The application/service is restarted, because in the initailization phase we delete our old log file and create a new one.

    When we start the service it works fine and our log file is filled with nice logs.

    When we do the callback, the logfile is deleted and contains new log entries from the initialization phase, but with new timestamps.

    We do not see errors in the OS event log.

    I am working now to get the remote debugger running.

    Nevertheless, could it be a security issue?

    Regards

    RB


    Thursday, May 2, 2013 11:54 AM
  • Hi RB,

    Do you mean whether the "remote debugging setup" will cause security hole?
    The remote debugging tool will require you to start the remote debugger on the product server. and only when it is running will the certain port be listened for client debugging requests. After you close the remote debugger, client machine will not be able to attach to it again.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, May 3, 2013 1:48 PM
    Moderator
  • Hello Steven,

    no, I am not asking about a security issue with the Debugger.

    My concerns are going into a direction that the Duplex channel api has different security issues on Server 2008 than on W7. May be some security configuration has to be adapted on the Server, or the security mode of the API call has to be changed when running on Server 2008.

    Regards

    RB

    Friday, May 3, 2013 2:02 PM

  • Hi RB,

    yes, you're right that for WCF duplex binding based service, the client-side (which expose a callback channel to server) need to make sure a certain endpoint is opened (address+port that is accessible by the service side). You can specify the endpoint base address via the WSDualHttpBinding.ClientBaseAddress property (in code or in config file). And you need to make sure the certain port is opened in firewall in case the client machine is behind firewall.

    #WSDualHttpBinding.ClientBaseAddress Property
    http://msdn.microsoft.com/en-us/library/system.servicemodel.wsdualhttpbinding.clientbaseaddress.aspx

    #Duplex Services
    http://msdn.microsoft.com/en-us/library/ms731064.aspx

    One thing you can also take a look is that there is a custom duplex http binding developed which is implemented via a polling code logic so it won't require an additional reverse endpoint exposed from client-side.

    #WCF Custom Channel: DuplexHttp
    http://archive.msdn.microsoft.com/duplexhttp


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, May 6, 2013 3:14 AM
    Moderator
  • Hello Steven,

    thank you for your answer, but this is not what I meant.

    The binaries are working in principal on W8, so endpoints and ports are working.

    We have disabled the firewall on the server 2008 so all ports are accessibel.

    I am not talking about external security, but internal API security. Do we have to set certain security modes on the API?
    Do we have to enable some .net access control properties?

    Do we have to register the files in GAC on the server?

    The breakpoint in our callback duroing debugging is not hit.

    There must be someting going wrong on the WCF layer or IIS.

    Regards

    RB

    Tuesday, May 7, 2013 8:16 AM
  • Hi,

    It seems to be an environment specific issue as Steven told. The IIS restarts after certain number of exceptions (I believe its 5). Please check either WCF traces or IIS log for the exceptions.

    If this does not help you, we may dig more into the issue understanding your environment and taking memory dump.

    From a support perspective this is really beyond what we can do here in the forums. If you cannot determine your answer here or on your own, consider opening a support case with us.

    Visit this link to see the various support options that are available to better meet your needs:  http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Thanks

    Thursday, May 9, 2013 9:29 PM