0

Developed a hello word in ASP.NET Core, an application windows "VS_17" .

I then published code and deployed in Linux Apache server. I am able to see the website but no styles, bootstrap are reflects in the site. I could see the reference in developer tool.

Like this

"src="/lib/jquery/dist/jquery.js" "

It tried giving Linux folders static path also.

Any help please its taking more time.

5
  • Have you checked the css files urls in developer tool network tab? What happens when you try to access the css file(s) directly using the browser? Commented Jul 14, 2018 at 3:34
  • network result is 404, src="~/lib/bootstrap/dist/js/bootstrap.min.js" this is the code i used . publised code has lib under wwwroot in linux server. i tried to access the publised site from machine servername/port ...asp.net core app Commented Jul 14, 2018 at 8:10
  • any update please Commented Jul 16, 2018 at 1:19
  • i have tried also setting content root directory in application Iwebhost Commented Jul 16, 2018 at 1:24
  • worked issue is with content root directory Commented Jul 17, 2018 at 0:16

1 Answer 1

0

What worked for me was to add this in Program.cs:

public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseKestrel()
                      .UseContentRoot(AppContext.BaseDirectory)
                      .UseUrls("http://*:6056")
                      .UseStartup<Startup>();
                })
                
    }

AND to deploy the application with the script as shown in this anwser
Application was deployed on RockyLinux, with no nginx
Inspired by this other answer

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.