I cannot connect to my WCF services while using the Visual Studio 2010 profiler RRS feed

  • Question

  • Basically I have a 2-Tier application. Winforms and a MiddleTier which is WCF using the net.tcp binding.

    I have had no problems profiling my Winforms application but now I am trying to profile some web services on the middle tier. I do the same steps, create a new profiler using the wizard, select instrumentation, select all IIS hosted service and the class libraries in the middle tier app. I then select my winforms app exe to use to run the services. When I click start profiling, for one it takes a very long time to get going, then eventually I see the profiler start up. Then I see my winforms app start up and it immediately crashes with the error:

    Could not connect to net.tcp/localhost/SSCL.SQS.MT.IISMIddleTierHost/SystemService.svc/mex. The connection attempt lasted for a time span of 00:00:02:0012001. TCP error code 10061: No connection could be made because the target machine actively refused it

     It seems I start getting this error even after I have profiling turned off. I couldn't for the life of me get it working again. I restarted IIS, recycled my app pool, restart VS, rebuilt everything and I was still getting this error. I rebooted my machine and everything is back to normal. I've tried this a few times now and it seems everytime I start profiling my middletier, the winapp continues to crash with this error until I reboot.

    Another thing I've noticed is that even while I am having this problem I can still see the service in the browser by using http://localhost/SSCL.SQS.MT.IISMiddleTierHost/SystemService.svc?wsdl and the svcutil can even generate classes from it.

    • Edited by bccollin Wednesday, May 19, 2010 12:54 PM
    Tuesday, May 18, 2010 6:10 PM

All replies

  • I believe I have found the source of this connection failure. It seems that as soon as I begin profiling the middletier my NetTcpActivator service is stopped. I can restart it and begin to use, as soon as I stop the profiler it stops the service again. Why would this be happening?

    Also another problem, while I was able to call into my service by restarting the service after profiling begins, I now have a new error: we are using HIS servers db2 adapters for talking to the AS400 and when my application tried to make a AS400 call while profiling is on I am getting the error: 


    System.DllNotFoundException: Unable to load DLL 'msdrda.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

       at Microsoft.HostIntegration.MsDb2Client.NativeMethods.DRDAGetConnection(ConnectInfo[] connInfo, Int32 usePooling, IntPtr& connection)

       at Microsoft.HostIntegration.MsDb2Client.DrdaAr.GetConnection(ConnectInfo[] connInfo, Boolean usePooling)

       at Microsoft.HostIntegration.MsDb2Client.MsDb2Connection.Open()

       at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)

       at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)

       at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)

       at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)

       at SSCL.SQS.ERPService.Service.ApAuthenticLogin(String user_id, String pwd_in, String& loginapproved, String& default_company, String& erp, String& default_branch, String& user_language, Int32& counter, String& rep_number, String& rep_name, String& buyer_number, String& first_name, String& last_name, String& email_address, String& response_code) in C:\Source\VS.NET\MiddleTier\SSCL.SQS.ERPService\ERPService.cs:line 3202}

    Running it without the profiler works fine, and the dll loads.

    • Proposed as answer by Mike1D Thursday, September 2, 2010 12:12 AM
    Tuesday, May 18, 2010 6:28 PM
  • Please help, I'd really love to find the source of these bottle necks before my boss comes back from vacation:(
    Thursday, May 20, 2010 12:53 PM
  • Hello bccollin,

    Thanks for your report!

    Would you please take a look at this KB article:

    Please install the latest HIS server to fix the issue. Also, as you could see, please make sure you avoid those two scenarios which could cause the data curruptted.

    Hope this helps!

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    • Marked as answer by liurong luo Tuesday, May 25, 2010 10:32 AM
    • Unmarked as answer by bccollin Thursday, May 27, 2010 5:27 PM
    Friday, May 21, 2010 9:37 AM
  • Thank you, but I'm not sure if this is the same issue. I am only getting that error when trying to run my app with profiling enabled. Normally the application runs fine. Also what about the issue with my nettcpactivation service getting stopped every time I stop or start the profiler? Is this supposed to happen?
    Wednesday, May 26, 2010 8:39 PM
  • anyone?
    Thursday, June 10, 2010 2:17 PM
  • .....
    Wednesday, July 7, 2010 12:55 PM
  • bump
    Wednesday, July 14, 2010 3:17 PM
  • sigh
    Monday, July 19, 2010 12:45 PM
  • ....
    Wednesday, July 21, 2010 5:38 PM
  • ....
    Tuesday, August 3, 2010 3:23 PM
  • Hi bccollin,

    After 3 days of beating my head against a wall, I finally found this post by you. I too had the "No connection could be made..." issue and also could not resolve it without rebooting. Your statement:

    "It seems that as soon as I begin profiling the middletier my NetTcpActivator service is stopped""

    is exactly the problem. Seems obvious now!

    Thanks so much for your post,


    Thursday, September 2, 2010 12:12 AM
  • Likewise. Same problem trying to profile an SL5 app.  All activators terminated when starting tor profile. They don't restart. They have to be manually restarted.

    The windows event log suggests that faults are not handled properly in my WCF service, and this kills the activators.

    An unhandled exception occurred and the process was terminated.

    Application ID: DefaultDomain

    Process ID: 3892

    Exception: System.Runtime.Serialization.SerializationException

    Message: Type 'System.ServiceModel.Channels.ReceivedFault' in Assembly 'System.ServiceModel, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.

    StackTrace:    at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)

    Tech Lead

    Tuesday, December 18, 2012 12:26 PM