c # - Hvordan slippe af med en cirkulær service reference?

Indlæg af Hanne Mølgaard Plasc

Problem



Jeg har set en række lignende spørgsmål, men ingen får fejlen på samme måde, så jeg vil sende det.


Jeg oprettede en ny Windows Service i Visual Studio 2015, x64. Da jeg var færdig med kodning/testning, tilføjede jeg serviceinstallatøren. Hver gang jeg forsøger at installere tjenesten fra kommandolinjen lykkes det, men undlader at starte.


Jeg installerer tjenesten med:


c:WindowsMicrosoft.NETFramework64v4.0.30319InstallUtil.exe VerifyVideoFiles.exe


Dette giver:


Running a transacted installation.

Beginning the Install phase of the installation.
See the contents of the log file for the C:TFSApps...VerifyVideoFiles.exe assembly's progress.
The file is located at C:TFSApps...VerifyVideoFiles.InstallLog.

The Install phase completed successfully, and the Commit phase is beginning.
See the contents of the log file for the C:TFSApps...VerifyVideoFiles.exe assembly's progress.
The file is located at C:TFSApps...VerifyVideoFiles.InstallLog.

The Commit phase completed successfully.

The transacted install has completed.


Når jeg forsøger at starte det manuelt, får jeg:


Indtast billedbeskrivelse her [6]


Jeg skabte en simpel metode til at spytte ud af alle afhængighederne, men jeg kunne ikke se nogen cirkulære referencer:


    private static HashSet<string> ReferencedAssemblies = new HashSet<string>();

    ...
    OutputDependencies(Assembly.GetAssembly(typeof(Program)), 0);
    ...

    static void OutputDependencies(Assembly assembly, int indent)
    {
        if (assembly == null) return;

        Console.WriteLine(new String(' ', indent * 4) + assembly.FullName);
        if (!ReferencedAssemblies.Contains(assembly.FullName))
        {
            ReferencedAssemblies.Add(assembly.FullName);

            foreach (var childAssembly in assembly.GetReferencedAssemblies())
            {
                OutputDependencies(Assembly.Load(childAssembly.FullName), indent + 1);
            }
        }
    }


Dette udfører listen over DLL'er, der bruges:


VerifyVideoFiles, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
        mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
        System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
            mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System.Data.SqlXml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                    mscorlib, Version=4.0.0.0, Cultur'VerifyVideoFiles.vshost.exe' (CLR v4.0.30319: VerifyVideoFiles.vshost.exe): Loaded 'C:WINDOWSMicrosoft.NetassemblyGAC\_MSILSystem.Data.SqlXmlv4.0\_4.0.0.0\_\_b77a5c561934e089System.Data.SqlXml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
                    System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                    System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
            System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
                mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System.Xml
                System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                    mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
        System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
        mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
        System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
        System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
        System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            System.Xml
            System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            System.ServiceModel.Internals, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
                mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            SMDiagnostics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
                System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System.ServiceModel.Internals, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
                System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
        System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
                mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
            System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
            System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
            Accessibility, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
                mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            System.Deployment, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
                mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
                System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
                System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            System.Runtime.Serialization.Formatters.Soap, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
                mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    System.ServiceProcess, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
        mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
        System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
        System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
        System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
        System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
    System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    ScannerCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
        mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
        System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
        System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
        System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089


Fed med dette projekt startede jeg en anden. Endnu en gang får jeg den samme fejl. Samme liste over DLL'er.


Forsøgte at bryde scanningskoden ud på et bibliotek ved hjælp af det fra Windows Service-projektet. Samme problem.


Jeg har heller ikke andre tjenester, som denne kode afhænger af:


Indtast billedbeskrivelse her [7]


Jeg kørte kommandoen sc.exe på konsollen, og den viser ingen serviceafhængigheder:


C:...x64Release>sc qc VerifyVideoFiles
[SC] QueryServiceConfig SUCCESS

SERVICE\_NAME: VerifyVideoFiles
        TYPE               : 10  WIN32\_OWN\_PROCESS
        START\_TYPE         : 2   AUTO\_START
        ERROR\_CONTROL      : 1   NORMAL
        BINARY\_PATH\_NAME   : "C:TFSApps...VerifyVideoFiles.exe"
        LOAD\_ORDER\_GROUP   :
        TAG                : 0
        DISPLAY\_NAME       : VerifyVideoFiles
        DEPENDENCIES       :
        SERVICE\_START\_NAME : Ed


Jeg har lige oprettet en tom Windows Service og installeret den. Samme fejl. Måske noget Wonky med VS2015 s installatør skabelon?


Enhver ide? Eventuelle yderligere oplysninger, jeg kan levere?


Tak!

Bedste reference