TechnitiumSoftware / DnsServer

Technitium DNS Server
https://technitium.com/dns/
GNU General Public License v3.0
4.27k stars 418 forks source link

DnsServer starts but immediately fails - Event ID 1026 #616

Closed mwherman2000 closed 1 year ago

mwherman2000 commented 1 year ago

When I try to start the DnsServer from the DNS Server App (Service > Start), I get the service started message but the service immediately fails (stops). DNS Server is being installed with compiled DnsServerSetup supplied with the project.

image

Application: DnsService.exe
CoreCLR Version: 7.0.523.17405
.NET Version: 7.0.5
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException: Could not load file or assembly 'TechnitiumLibrary.Net, Version=8.2.1.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'TechnitiumLibrary.Net, Version=8.2.1.0, Culture=neutral, PublicKeyToken=null'
   at DnsServerCore.DnsWebService.StopAsync()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at DnsServerCore.DnsWebService.StopAsync()
   at DnsServerCore.DnsWebService.DisposeAsync() in C:\Web7\DnsServer\DnsServerCore\DnsWebService.cs:line 153
   at TechnitiumLibrary.TaskExtensions.Sync(ValueTask task) in C:\Web7\TechnitiumLibrary\TechnitiumLibrary\TaskExtensions.cs:line 66
   at DnsServerCore.DnsWebService.Dispose() in C:\Web7\DnsServer\DnsServerCore\DnsWebService.cs:line 172
   at DnsServerWindowsService.DnsServiceWorker.Dispose() in C:\Web7\DnsServer\DnsServerWindowsService\DnsServiceWorker.cs:line 60
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.DisposeAsync()
--- End of stack trace from previous location ---
   at Microsoft.Extensions.Hosting.Internal.Host.<DisposeAsync>g__DisposeAsync|16_0(Object o)
   at Microsoft.Extensions.Hosting.Internal.Host.DisposeAsync()
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
   at DnsServerWindowsService.Program.Main(String[] args) in C:\Web7\DnsServer\DnsServerWindowsService\Program.cs:line 29

cc: @ruskpr

mwherman2000 commented 1 year ago

This is a fresh installation of DnsServer 11.1.1 on a Windows 11 Pro laptop. DnsServer has never been installed on the machine previously.

mwherman2000 commented 1 year ago

start.bat works properly

ShreyasZare commented 1 year ago

Thanks for the post. It seems that you have missed pulling the latest code for TechnitiumLibrary repo. Pull the code for it and then follow the steps to generate the windows setup.

mwherman2000 commented 1 year ago

We pulled it around noon today and followed Step 3 in these instructions: https://github.com/TechnitiumSoftware/DnsServer/blob/master/build.md#for-windows

ShreyasZare commented 1 year ago

Ok then it seems that for some reason, an older version of the DLL file is being installed. Try to compile both the solutions again in release mode and publish the system tray app and the windows service projects again.

mwherman2000 commented 1 year ago

K

mwherman2000 commented 1 year ago

No luck

Exception Info: System.IO.FileNotFoundException: Could not load file or assembly 'TechnitiumLibrary.Net, Version=8.2.1.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

Is this a problem with TechnitiumLibrary.Net missing or being the wrong version? ...or if TechnitiumLibrary.Net has a dependency on another assembly, can this also be part of the problem?

I need to leave this for this evening but we still need to figure this out.

What is the correct/most recent version of TechnitiumLibrary.Net?

ShreyasZare commented 1 year ago

No luck

Exception Info: System.IO.FileNotFoundException: Could not load file or assembly 'TechnitiumLibrary.Net, Version=8.2.1.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

Is this a problem with TechnitiumLibrary.Net missing or being the wrong version? ...or if TechnitiumLibrary.Net has a dependency on another assembly, can this also be part of the problem?

The error message comes same for both conditions. Check if the file exists in the installation folder. If it exists then its the wrong version issue.

I need to leave this for this evening but we still need to figure this out.

What is the correct/most recent version of TechnitiumLibrary.Net?

The recent version is 8.2.1 which the DNS server process is expecting.

mwherman2000 commented 1 year ago

This looks all correct... image

ShreyasZare commented 1 year ago

I am not exactly sure why its not working. However, there are some extra Technitium Library DLLs in the screenshot you posted that should not exists in the installation folder. You should have only the following DLLs files shown below:

image

Have you copied all the DLL files from the library project's bin folder here?

Are you using the exact output files generated when you publish both the DnsServerSystemTrayApp and DnsServerWindowsService projects from the DnsServer\DnsServerWindowsSetup\publish folder?

mwherman2000 commented 1 year ago

I've fixed the problem and it may have been my "user error" all along. My apologies for the firedrill.

We're about to add about a dozen custom resource records for our Web 7.0 project and in the past versions (from years ago), we'd link the TechnitiumLibrary projects into the DNSServer.sln solution so that we could compile and edit both sets of projects from the DNSServer solution. I think this messed things up. So we're back to keeping the 2 solutions completely separate.

My apologies.

mwherman2000 commented 1 year ago

Closed

ShreyasZare commented 1 year ago

Good to know you got it working.