1.11.0 No connection could be made because the target machine actively refused it (1 Viewer)

Snoopy87

Portal Pro
August 12, 2012
470
167
Home Country
Germany Germany
Hi,

I am using MediaPortal 1.8 and 1.9 and MPExtened. With my own application I control MediaPortal TV with MPExtended to tune a channel and retrieve the stream.

This is happening fine without any issues. But sometimes it suddenly don't work anymore and then TVService.exe is also not running anymore without any log entry why it is not running anymore.

Best regards,
Sascha
 

Attachments

  • tv service.txt
    458.3 KB

mm1352000

Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Hello Sascha :)

    If an application is crashing then usually the only way to figure out the cause is to attach a debugger or check what the Windows application event log says. It is difficult to help you without the application event log from your server. The watchdog/debug-tool includes the application event log, which is why I ask people to use it whenever possible.

    In short: please can you either post logs using the watchdog/debug-tool, or export and post the application event log, or check the application event log yourself.

    Regards,
    mm
     

    Snoopy87

    Portal Pro
    August 12, 2012
    470
    167
    Home Country
    Germany Germany
    Sorry, I didn't find anything usefull in other log files and event viewer, that's why I didn't upload them.

    I attached them to this post.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    The system event log shows:
    "09/01/2015 14:12:07";"Service Control Manager";"(0)";"Error";"The TVService service terminated unexpectedly. It has done this 1 time(s).";"3221232506"

    ...but no detail is shown in the application event log. Very odd.
    Is there no additional detail in the system event log?
    Do you have any kind of security software installed that could be interfering?
     

    Snoopy87

    Portal Pro
    August 12, 2012
    470
    167
    Home Country
    Germany Germany
    Hi :)

    It's not my PC. It's a clean Windows 7 installation. No additional security software is installed.

    This is my code:

    Code:
      string initUrl = string.Format("http://{0}:{3}/MPExtended/StreamingService/json/InitStream?type=12&provider=0&itemId={1}&clientDescription=Test&identifier={2}", settings.IP, settings.Channel, identifier, settings.Port);
           
                string activeTvCards = string.Format("http://{0}:{1}/MPExtended/TVAccessService/json/GetActiveCards", settings.IP, settings.Port);
             
    
                try
                {
                    var wr = System.Net.HttpWebRequest.Create(initUrl);
                 
                    var r = wr.GetResponse();
    
                    wr = System.Net.HttpWebRequest.Create(activeTvCards);
                  
                    r = wr.GetResponse();
    
                    string jsonString = string.Empty;
                    using (var stream = new StreamReader(r.GetResponseStream()))
                    {
                        jsonString = stream.ReadToEnd();
                    }
                    var jsonObject = Newtonsoft.Json.Linq.JArray.Parse(jsonString);
                    var streamingUrl = jsonObject.Where(j => j["ChannelId"].ToString() == settings.Channel.ToString() && j["User"]["Name"].ToString() == "mpextended-" + identifier).Select(u => u["RTSPUrl"].ToString()).FirstOrDefault();
    
    
                    mediaElement.Source = new Uri(streamingUrl);
                    mediaElement.Play();
                }
                catch
                {
                    Stop();
                    throw;
                }

    And after a few minutes I call:

    Code:
      mediaElement.Stop();
      mediaElement.Source = null;
      mediaElement.Close();
     
      string endUrl = string.Format("[URL]http://{0}:{2}/MPExtended/StreamingService/json/FinishStream?identifier={1[/URL]}", settings.IP, identifier, settings.Port);
      var wr = System.Net.HttpWebRequest.Create(endUrl);
     
      wr.GetResponse();

    Then after a few minutes I call the first code (with a new MediaElement), and so on...

    This is working great for hours without any issues. But on that machine (which was set up new a few times, and also we tried different tv cards) after some time it is not working anymore and MPExtended is logging the above error and TVService is not running anymore. No other application is running and no user is interacting with the PC.

    Best regards,
    Sascha
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Hello Sascha

    I can't help with MPExtended; only with TV Server.
    I don't think the problem is related to tuners.
    Probably the only other thing that I can add is that in my opinion you should be Close()'ing/Dispose()'ing your HTTP web responses. In my own code I've experienced problems trying to create new requests if I don't properly close the old responses.

    Sorry I can't be more helpful,
    mm
     

    johanj

    MP Donator
  • Premium Supporter
  • January 31, 2009
    781
    398
    46
    Home Country
    Sweden Sweden
    I sometimes have the same issue after streaming tv to MediaPortal iViewer. MPExtended reports no connection to tv-service when it happens. At those times the tv-server works since I can watch tv inside MP. MPExt and MP on same pc. So it could be that MPExtended failed to close/dispose.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Hmmm, your experience sounds a bit different Johan... because unless I have misunderstood, the TV service actually crashes in Sascha's case, but without any entry in the Windows application or system event logs to tell us why the crash happens. However in your case the TV service never crashes, right?
     

    johanj

    MP Donator
  • Premium Supporter
  • January 31, 2009
    781
    398
    46
    Home Country
    Sweden Sweden
    Yes, Im quite sure that the tv-service didnt crash, only MPExt connection to tv-service. I will check the status of tv-service and all the cards the next time it happens.
     

    Snoopy87

    Portal Pro
    August 12, 2012
    470
    167
    Home Country
    Germany Germany
    Hi,

    attached is a sample project. Please run it, enter the IP address, port and channel id and click on "Start". This will create a loop where the channel is streamed for a few seconds, stopped and streamed again. After 5,10 or 30 minutes it crashes (due to missing exception handling). At this moment the MediaPortal TV Server is not running anymore (crashed without any error message!) and MPExtended is also logging an error.

    Attached you will also find the log files of my test.

    Please make sure that you have installed the DirectX March 2009 Runtime: http://www.microsoft.com/download/details.aspx?id=19743 and of course MPExtended on your server side.

    Thanks a lot and best regards,
    Sascha
     

    Attachments

    • MediaPortalTest.zip
      4.5 MB

    Users who are viewing this thread

    Top Bottom