locked
Hosted Asp.net mvc core app shows list of Files instead of Home Page RRS feed

  • Question

  • User-1881312316 posted

    Hello everyone, 

    I've published my app into release Version in order to host it on locally IIS server, the app is published correctly and is hosted on the server, but when I open the url in the browser for the hosted app it shows me the list of files in that directory instead of my app Home page.

    here's a screen shot of my problem

    https://imgur.com/K4gqbql

    and this is the code for my web.config file

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <directoryBrowse enabled="true" />
            <defaultDocument>
                <files>
                    <clear />
                    <add value="index.html" />
                    <add value="Default.htm" />
                    <add value="Default.asp" />
                    <add value="index.htm" />
                    <add value="iisstart.htm" />
                    <add value="default.aspx" />
                </files>
            </defaultDocument>
        </system.webServer>
    </configuration>
    

    can you help me please 

    Monday, August 19, 2019 7:54 AM

Answers

All replies

  • User-1038772411 posted

    Hi, Jamal Aleklani

    in your finally forlder or controller use their index method and return than page from controller return view and that page return view(--you can pass model or directory files for display on view--);

    Thanks.

    Monday, August 19, 2019 8:09 AM
  • User-1881312316 posted

    I'm afraid that I don't understand !

    the app works 100% on Visual studio when I start it in Debug Mode.

    the finally folder is the released version of my app I don't know what to do !

    Monday, August 19, 2019 8:12 AM
  • User-474980206 posted

    what are you hosting with?

    if IIS then you need to install the AspNetCore core module and follow the configuration instructions.

       https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.2

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 19, 2019 10:34 PM
  • User711641945 posted

    Hi Jamal,

    First,Please check if you have installed the .NET Core Hosting Bundle package,you could refer to: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.2#install-the-net-core-hosting-bundle

    Then you need to check your web.config file like below.Actually if you follow the official document and publish correctly,it would automatically add these code:

    <configuration>
      <location path="." inheritInChildApplications="false">
        <system.webServer>
          <handlers>
            <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
          </handlers>
          <aspNetCore processPath="dotnet" arguments=".\YourProjectName.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
        </system.webServer>
      </location>
    </configuration>

    Best Regards,

    Rena

    Tuesday, August 20, 2019 8:06 AM
  • User991566988 posted

    What is the version of core you use?

    Monday, August 26, 2019 9:20 AM
  • User-1881312316 posted

    thank you bro, it worked 

    Wednesday, August 28, 2019 2:27 PM