loic-sharma / BaGet

A lightweight NuGet and symbol server
https://loic-sharma.github.io/BaGet/
MIT License
2.61k stars 670 forks source link

HTTP Error 500.19 with IIS setup #243

Open Buzzzsaw opened 5 years ago

Buzzzsaw commented 5 years ago

Describe the bug

Server responds with an HTTP Error 500.19 with an IIS setup after trying to access it from another machine. Full error information:

_ _ _ _
Module IIS Web Core Requested path http://localhost:5000/
Notification Unknown Physical path
Handler Not yet determined Logon method Not yet determined
Error code 0x8007000d Logon user Not yet determined
Config error
Config file \\?\C:\inetpub\wwwroot\BaGet\web.config

Config source: -1: 0:

The error happens both on localhost and remote PC, after first trying to access the server from another PC.

To Reproduce

Steps to reproduce the behavior:

  1. Using version of BaGet.zip 0.1.70
  2. Unpack to C:\inetpub\wwwroot\BaGet\
  3. Follow steps from documentation to install as an IIS, including adding folder permissions.
  4. Access from the server itself to http://localhost:5000/ and observe that the home page works as intended.
  5. Access from another PC on the network to http://servername:5000/ that already has access to other working services on the server (ex.: Jenkins) and observe a 500 internal error.
  6. Access from the server itself again to http://localhost:5000/ and observe an HTTP Error 500.19 with the error information provided earlier.

Expected behavior

Being able to at least access the home page from the server itself.

Additional context

I am basically following the steps in Getting started and IIS setup without touching any configuration file.

Cocotus commented 5 years ago

I had the exact same problem and I got it to work after installing latest NET Core Hosting Tools for IIS and restarting the machine. Before like you I only could call localhost:5000 on IIS server itself. Now I can reach Baget from outside.

Don't forget to restart because otherwise you will get another HTTP error... Here's the download I used: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.2#install-the-net-core-hosting-bundle

loic-sharma commented 5 years ago

@Buzzzsaw could you check if what @Cocotus describes fixes your issue? If not, I'll dig deeper into this issue.

EmmaRenee commented 5 years ago

I had a similar issue with 500 errors. For me the resolution was to step down from .Net Core 3.0 to 2.2.

vishva-karma commented 5 years ago

I too had the same problem. The fix from @Cocotus saved my day. 👍

In addition, to be able to access in LAN, I need to run the following command > netsh advfirewall firewall add rule name="Open Port 5000" dir=in action=allow protocol=TCP localport=5000

loic-sharma commented 4 years ago

Thanks everyone for the help. It seems there's two things I can do to reduce these kinds of errors:

  1. Update the IIS documentation with @Cocotus's suggestion here: https://github.com/loic-sharma/BaGet/issues/243#issuecomment-476028479
  2. Update ALL documentation to clarify which version of .NET Core you should be using
  3. Make BaGet's GitHub release a self-contained application, as suggested by @iwhiz: https://github.com/loic-sharma/BaGet/issues/389

Please let me know if you have any other suggestions on how I can improve these kinds of issues!

vishva-karma commented 4 years ago

Considering my use case, where the hosting server is not connected to the internet, I am more biased towards step 3. But, other steps 1 and 2 are also great.

akrisiun commented 4 years ago

I wanna add my 50 cents, because today I spend several hours make to run this project with IIS. Worked only OutOfProcess process hosting model (for CoreModuleV2 version) Finished with working this web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
      <handlers> 
          <remove name="aspNetCore" />
          <add name="aspNetCore" path="*" verb="*" 
               modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore 
          processPath="dotnet" arguments="./BaGet.dll" 
          stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" 
          forwardWindowsAuthToken="false"
          hostingModel="OutOfProcess" >
          <!-- hostingModel="InProcess" > -->
          <environmentVariables>
            <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
          </environmentVariables>
      </aspNetCore>
  </system.webServer>
  <!-- 
  https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.0 
  -->
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <applicationInitialization doAppInitAfterRestart="true" />
    </system.webServer>
  </location> 
  <!-- global Windows/System/InetSrv config reference for .dll:
     <add name="AspNetCoreModuleV2" 
      image="%ProgramFiles%\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll" />
  </globalModules> -->

</configuration>

& "C:\Program Files\IIS Express\iisexpress.exe" /path:$p /port:7000 /trace:error



I hope for someone be usefull info (because baget docs for IIS to short...:P).
I was using NugetGallery for 2 last years. Now I moved to this great project. 
With Docker Desktop version for macOs had no problems to run. 
loic-sharma commented 4 years ago

Thanks for the information @akrisiun! I've never used IIS myself, so sadly I don't have the knowledge to further improve the docs. Let me know if there's anything you think we should add (or feel free to open a pull request!)

kheaactua commented 4 years ago

I know virtually nothing about IIS, but, when I used @akrisiun web.config file, my logs started working which showed me my actual error (that my packages path was wrong)