Benas
Benas

Reputation: 39

Website can't access files in wwwroot directory on Asp.Net Core 2.1

The website works perfectly in Visual Studio, but then I export it using dotnet pusblish and run it, website can't access any files in wwwroot directory. I am on admin account, so no issues there. Moreover, I though, this might be a problem with my project, but even if I created a new one, don't change anything and export it, still the same issue. I am using Windows 10 64-bit.

Edit 1 Tried a different approach and deployed using Visual Studio to iis, but still no luck

Upvotes: 0

Views: 1986

Answers (1)

Benas
Benas

Reputation: 39

Finally after hours of trial and error I found a solution. In the _Layout file i had multiple tags and it only executed one, so after putting everything into the same tag I solved half of the problem. The other problem, which I still don't know what caused, I resolved by not portable and restrictive way, but I had to specific exact location of wwwroot file in a disk using .UseWebRoot(@"C:####\wwwroot").

Upvotes: 1

Related Questions