Base solution for your next web application
Open Closed

Api not working on server #5028


User avatar
0
vermis created

Dear,

I downloaded AspNetZero template v 5.3 and got it work locally on my PC with the DB in Azure. It is working locally on my PC ( running the core app in debug mode in Visual Studio ). It is also working if you move all the source code to the server and run it there in Visual Studio. I use Swagger to login to the API and it is working.

The problem is when I deploy it to IIS. I do the deploy with Visual Studio deploy to a folder and then copy the files to IIS.

The first problem was the missing folder "plugins". I needed to create it manually on the server to get the app working. I get the Swagger page.

When I try to login on the Swagger page I am getting error 500 from API and javascript popup "Login failed!". There are no detailed errors in the API response.

The second problem is how to get the detailed errors returned from the API calls?

I tried to activate the NLog logs but also without luck on the server. Locally it is working. Attached is the Log4Net.config that I am using.

I also tried a deploy to Azure App Services to eliminate the option of a misconfiguration on my server. The same issue. First missing "Plugins" folder, then working Swagger but not possible to login.

To recap: The same app is working in Visual Studio but not deployed on IIS. The app is working but the login not. How to debug this?

Best regards, Damir

<?xml version="1.0" encoding="utf-8" ?> <log4net> <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender" > <file value="Logs.txt" /> <appendToFile value="true" /> <rollingStyle value="Size" /> <maxSizeRollBackups value="10" /> <maximumFileSize value="10000KB" /> <staticLogFileName value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%-5level %date [%-5.5thread] %-40.40logger - %message%newline" /> </layout> </appender> <root> <appender-ref ref="RollingFileAppender" /> <level value="ALL" /> </root> </log4net>


4 Answer(s)
  • User Avatar
    0
    vermis created

    I tested the whole app also with the template on .Net Framework 4.6.1 and exactly the same issue.

    Best regards, Damir

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @vermis,

    The issue about Plugins folder is fixed in this issue <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/968">https://github.com/aspnetzero/aspnet-ze ... issues/968</a> and will be in the next release, sorry for that.

    There must be logs in App_Data/Logs.txt file, have you checked that ? Also, have you configured appconfig.json and appsettings.json ? If so, can you share the content of those files ?

  • User Avatar
    0
    vermis created

    It is working now!

    I think a permission problem caused the log file not being written. Whit the logs file working I saw the problem was with the connection string in the .production and staging json files.

    Thank you for your help.

    Best regards, Damir

  • User Avatar
    0
    ismcagdas created
    Support Team

    Great :)