Search code examples
c#web-configasp.net-core-2.1

Request redirect to /Account/Login?ReturnUrl=%2f since the installation on server


I'm working with asp.net core 2.1, I launch the app on my local machine without any problem and I can debug it and open it on the browser but when I deploy it to the server I get the rediction error and I can't login.

Here is my web.config file :

<?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <appSettings>
        <add key="autoFormsAuthentication" value="false" />
        <add key="enableSimpleMembership" value="false" />
      </appSettings>
      <location path="." inheritInChildApplications="false" allowOverride="false">
        <system.webServer>
          <handlers>
            <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
          </handlers>
          <aspNetCore processPath="dotnet" arguments=".\BusinessAdvisor.Inventory.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
        </system.webServer>
        <system.web>
          <trust level="Full" />
        </system.web>
      </location>
      <system.web>
        <authentication mode="None" />
        <compilation defaultLanguage="c#" debug="true" />
      </system.web>
      <connectionStrings>
        <add name="DefaultConnection" connectionString="server=localhost;user id=????_dba;password=???????;database=atechdzc_mobiserv;allowuservariables=True;persistsecurityinfo=True;SslMode=none" />
      </connectionStrings>
    </configuration>
    <!--ProjectGuid: 5d471955-9737-4896-a960-3eb7ede4494e-->

I tried all the solutions montioned but I get the same error !

EDIT :

When I make the authentification to "Windows authentication" the error doesn't appear and if I make it as "Anonymous authentication" the error still here.


Solution

  • It was an error on my connection string and then the migration didn't update changes automaticaly. I fixed my connection string on appsettings.production.json and I updated the database.