Base solution for your next web application
Open Closed

Unable to setup and run in IIS server 2016 #5740


User avatar
0
rnguyen created

Hi,

I am trying to deploy my first Metronic template to the website but was not successful to launch the site. Everything is working properly in my local server

I follow this url https://aspnetzero.com/Documents/Step-by-step-core-publish-to-iis .

1 Using MVC .net core 2.1 with Jquery 2. Only Change WebsiteRootAddress to Http://xyz.com 3. publish the site to folder and copy it to the inetpub area for the launch

  1. appsettings.production.json

  2. Got this error when I launch the website

  3. when I try to look into the logs\stdout nothing in the stdout folder

  4. Please tell me what other thing that need to setup in appsettings.json or appsettings.production.json


6 Answer(s)
  • User Avatar
    0
    slamj1 created

    Hi @rnguyen, I see from your request screenshot(s) you are hitting the url http://aixem.com. Your ServerRootAddress, ClientRootaddress CorsOrigin must be set according to the url requested (i.e. http://aixem.com).

    Your other screen indicates http://xyz.com which would of course be incorrect given the screenshots you've provided. In this case, this would definitely produce a CORs pre-flight access error.

    Can you provide a screenshot of your network tab under the F12 tools? This would indicate any access errors.

  • User Avatar
    0
    mumfie created

    Hi rnguyen, Does the log output folder exist and does the apppool have write access to it? This link might be usefull https://odetocode.com/blogs/scott/archive/2018/07/16/7-tips-for-troubleshooting-asp-net-core-startup-errors.aspx

  • User Avatar
    0
    rnguyen created

    xyz.com is an example.

    can we setup a call using teamviewer today ?

  • User Avatar
    0
    slamj1 created

    I'm unable to support you via Teamviewer, but you need to ensure your CORs settings are correct. As @mumfie suggested check your apppool permissions for the site. Ensure whatever account you're running under has read/write access to your host database.

    Also, check your app_data log folder (ensure your apppool account has modify/write access to this folder as well), the logs should provide more info.

  • User Avatar
    0
    rnguyen created

    I was able to solve this issue by adding

    <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />


    <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <handlers> <add name="aspNetCore" path="" verb="" modules="AspNetCoreModule" resourceType="Unspecified" /> </handlers> <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00" >

      &lt;environmentVariables&gt;
        &lt;environmentVariable name=&quot;ASPNETCORE_ENVIRONMENT&quot; value=&quot;Production&quot; /&gt;
      &lt;/environmentVariables&gt;
    
    &lt;/aspNetCore&gt;
    &lt;httpProtocol&gt;
      &lt;customHeaders&gt;
        &lt;remove name=&quot;X-Powered-By&quot; /&gt;
      &lt;/customHeaders&gt;
    &lt;/httpProtocol&gt;
    

    </system.webServer> </configuration>

  • User Avatar
    0
    slamj1 created

    @rnguyen, glad to hear you found the problem.

    Some additional info for other users is that the ASP.NET core environment can also be set right in the Windows environment under Control Panel > System > Advanced system settings | Environment variables.