microsoft / IIS.WebManager

Web Manager for managing IIS
Other
157 stars 52 forks source link

Unknown error has occurred when trying to initialize Web Server Module: "The remote server returned an error: (400) Bad Request." #510

Closed siggima closed 2 years ago

siggima commented 2 years ago

Hi I installed IIS Extension on Server 2022 and when I try to open I get this error, I use wac as a gateway I am running version 2110 build 1.3.2111.01001 Unknown error has occurred when trying to initialize Web Server Module: "The remote server returned an error: (400) Bad Request." image

eliassal commented 2 weeks ago

I even downloaded version 6.0.0. at https://github.com/microsoft/IIS.Administration/releases/download/v6.0.0/IISAdministrationSetup.exe, I get the same exact error

yaqiyang commented 2 weeks ago

You should be using v6.0 after uninstalling v2.3.0. First try to uninstall v2.3.0. If you are getting permission errors, you can remove the C:\Program Files\IIS Administration folder manually. First stop the IIS Administration service in Services. The owner of the folder is System. You need to change ownership and assign yourself permissions. See https://www.techrepublic.com/article/how-to-control-files-windows/.

After you have uninstalled v2.3.0, install v6.0.

eliassal commented 2 weeks ago

@yaqiyang , I really tried everything, removed folder , repair, uninstall always getting the same error message. I even logged as local admin and tried same steps same results. Microsoft_IIS_Administration_2.3.0_20241006180941.log Here the log file for the last try

yaqiyang commented 2 weeks ago

What is the current error message now? Have you successfully installed v6.0 yet?

eliassal commented 1 week ago

Whateever I do, repair, uninstall, or try to install version 6 I get the same exact error message

Image

yaqiyang commented 1 week ago

I see. Have you removed the C:\Program Files\IIS Administration folder manually? If you cannot remove it, you did not do one of these things correctly.

  1. Stop service "Microsoft IIS Administration". Open Task Manager, go to Services, then Search for "IIS" in the top search box, then stop "Microsoft IIS Administration".
  2. Take ownership of folder C:\Program Files\IIS Administration. https://www.techrepublic.com/article/how-to-control-files-windows/. You must be the owner of this folder.
  3. Give yourself Full Control permissions for C:\Program Files\IIS Administration folder , https://helpdeskgeek.com/windows-11/how-to-set-file-and-folder-permissions-in-windows/. You must have full control permissions for this folder.

Now, you should be able to remove the C:\Program Files\IIS Administration folder. After that install v6.0.

eliassal commented 1 week ago

Yes @yaqiyang I did all steps, and here anotther try, as you can see no IIS admin in Program files

Image

Service is not running Image

Here is wat happens Image

Image

And here is the log file Microsoft_IIS_Administration_6.0.0_20241009175652.log

yaqiyang commented 1 week ago

There are some problems with system account. Can you reboot your machine and retry installing v6.0?

eliassal commented 1 week ago

I did 2 times it did not help

yaqiyang commented 1 week ago

Go to %temp% folder (it should be something like C:\Users\{userid}\AppData\Local\Temp when expanded), there should be a log file like, _Microsoft_IIS_Administration_6.0.0_20241009095558_002_iis_administrationmsi.log. Get the newest one. It might have some useful information. The log you posted does not have much information about the failure.

eliassal commented 1 week ago

I did open the file Image At the end I see only the following but no reason for the failure MSI (s) (70:18) [17:57:35:536]: Product: Microsoft IIS Administration -- Installation failed.

Here is the full log file Microsoft_IIS_Administration_6.0.0_20241009175652_000_iis_administration_msi.log

yaqiyang commented 1 week ago

It does have good info in the log. The installation failed because the service "Microsoft IIS Administration" already exists. You can manually delete it, https://www.elevenforum.com/t/delete-services-in-windows-11.3108/

eliassal commented 1 week ago

Thanks @yaqiyang , yes setup went through after removing the service. However, after setting up version 6, updted appsettings as follows

Image

Image

Nothing can be displayed in browser regarding https://localhost:55539/
Image

and even now when I try to connect to the machine inside WAC it gives an error message not very useful as follows

Image

I removed WAC reinstall it it gives the exact same error

yaqiyang commented 1 week ago

Restart service "Microsoft IIS Administration", then open https://localhost:55539 or https://localhost:55539/connect

eliassal commented 1 week ago

No way Iid that several tims Image

Image

yaqiyang commented 1 week ago

Does it work if you use your computer name instead of "localhost"? Also see https://stackoverflow.com/questions/43638910/cannot-connect-to-localhost-on-server-running-iis

eliassal commented 1 week ago

No, I tried both localhost and my computer name, here is in firefox Image

and in Edge

Image

yaqiyang commented 1 week ago

I get the same error message if I remove Microsoft IIS Administration Server Certificate from IIS manager and reboot my computer. But after I uninstall-reinstalled IIS Administration v6.0, the problem goes away. Do you still have v2.3.0 installed? Uninstall it, then uninstall v6.0, and re-install v6.0.

Image

eliassal commented 1 week ago

Microsoft_IIS_Administration_2.3.0_20241011105532.log Yes, 2.3.0 is still sitting there in apps&feature but as you instructed me, I removed the folder 2.3.0 then removed the servic e which allowed me to install V6, now when I try to remove it in Settings > Apps & features I get setup failed

Image

and here is the log file

yaqiyang commented 1 week ago

I don't think you have to uninstall v2.3.0. Is your certificate there and valid?

Just in case you want to clean it up. Here is what you can do,

eliassal commented 1 week ago

Yes certificate is valid until 2026 1st 3 steps wenth through and I was able to remove 2.3.0 Repairing V6 is really a big issue, in spite of the fact that I took ownership of the folder IIS Administration and its subfolders, everytime I get " insufficient privileges " for a dll different

Image

Image

Image

yaqiyang commented 1 week ago

The error basically indicates that Microsoft IIS Administration service is running. Not sure why it came back. It should have been deleted when uninstalling v2.3.0. Delete it again and then Repair.

eliassal commented 1 week ago

This is the casem service was removed, it does not exist anymore

Image

yaqiyang commented 1 week ago

Send me the newest Microsoft_IIS_Administration6.0.0*****_iis_administration_msi.log from %temp% folder again

eliassal commented 1 week ago

Here is the latest one

Microsoft_IIS_Administration_6.0.0_20241011195635_000_iis_administration_msi.log

yaqiyang commented 1 week ago

Nothing interesting. You can try manually removing folder C:\Program Files\IIS Administration\6.0.0, then Repair v6.0.

eliassal commented 1 week ago

I did, it gave the impression that repair will go through, no dll erros but setup failed, here are the 2 log files generated Microsoft_IIS_Administration_6.0.0_20241012183820_000_iis_administration_msi.log Microsoft_IIS_Administration_6.0.0_20241012183820.log

yaqiyang commented 1 week ago

The service "Microsoft IIS Administration" cannot be started. But it does not say why. Do these,

  1. Check if service "Microsoft IIS Administration" is running. If it is running, you might delete the service and re-run Repair command. I don't have a good idea in this case. Otherwise,
  2. Take ownership of folder C:\Program Files\IIS Administration
  3. Give yourself full control permissions to C:\Program Files\IIS Administration
  4. Open an Admin command prompt
  5. Run "C:\Program Files\dotnet\dotnet.exe" "C:\Program Files\IIS Administration\6.0.0\Microsoft.IIS.Administration\Microsoft.IIS.Administration.dll" This should show the errors why the service cannot be started.
eliassal commented 1 week ago

@yaqiyang I am a little bit confused, service does not show i servicess how do you want that it should run also as you requested I deletes version 6 folder so there is nothing in IIS admin folder Image

yaqiyang commented 1 week ago

Do you not have this service? If you don't have it, Repair v6.0 should succeed. How did you run Repair?

Image

eliassal commented 1 week ago

I ran it from settings > apps & features and I did also run as administartor using IISAdministrationSetup.exe Please note that in the IIS admin folder nothing added during the repair and as I said the service does not exist Image

yaqiyang commented 1 week ago

Try these,

Anyway, make sure you run sc delete "Microsoft IIS Administration" before you do a Repair. There is a corruption during the repair process and it did not succeed and then rolled back all changes. That is why you are not seeing any files under C:\Program Files\IIS Administration\6.0.0.

6.0.0.zip

yaqiyang commented 1 week ago

I reproduced your last issue (Connection was reset error) on a test machine. There was a failure during the installation process that it did not add the SSL certificate to port 55539. The installer did not report that, unfortunately. The fix is to add it manually by running, netsh http add sslcert ipport=0.0.0.0:55539 certhash=75270c21de1b55bf421a49f3e55dafd6aa13a9f7 where certhash is the certificate hash or thumbprint of the Microsoft IIS Administration Server Certificate that you can find in IIS manager.

Once you can get a successful Repair/Re-install of v6.0, you can run the above command if the certificate was not added by the installer.