1

From a remote server with Microsoft Server 2016 where I am admin, I publish my ASP.NET Core MVC web app in Visual Studio 2019 via IIS Server 2016 as a Website called "demo". dotnet-hosting-3.0.2-win, dot-net-3.0.102 sdk bundler and urlrewrite2 are installed. The project is just the simplest "Hello" demo, it works.

Then in I add a Virtual Directory to my website in order to display images from a shared folder.

When I create this Directory, I tried both methods: - "Connect as" / my user log. "Test settings" gives an OK icon. - "Application user" + Edit Permissions / Security / Edit / Add / IUSR

Once my Directory added, I can see the content of it in Content View panel, 2 images.

I also tried to add the Directory to wwwroot of my website.

enter image description here

I precise that in Features View panel, Directory Browsing is enabled. I also tried to access my images via code.

This is what I get:

enter image description here I am pretty new with deployment, still I have read a lot of documentation, but I can't make it work. What did I miss? Is there something to do with a webconfig in IIS?

GoupilSystem
  • 61
  • 1
  • 9

2 Answers2

0

I am not expert but as per my little understanding of IIS and ASP.NET MVC, please try following.

Click on your "demo" site in iis manager and on the right side, under "actions" pane click browse. And then navigate to your images folder from browser.

Also, you can only see individual files under this directory and not a list of files.

You can access individual file using the spcefic URL, for example http://localhost/images/image1.jpg

If you hit "http://localhost/images" this URL, IIS will try to find a controller or action method by this name.

  • Oh I did that, but I can't browse them even "manually". That being said, I realize that I can't even browse the local images in my wwwroot folder, and those ones are displayed in my website. That may be the symptom of a more general problem. – GoupilSystem Jan 20 '20 at 12:57
0

Lost my problem thanks to this link:

Virtual directory inside of ASP.NET Core app in IIS

The big picture I get is Net Core is just not designed by default for IIS/Virtual Directory, but you can get your stuff by modifying the applicationHost.config of IIS manager. Supposing your Virtual Directory is called "bilder" in the website "democore", you would write this at the end of your applicationHost.config:

enter image description here

Hope it will help.

GoupilSystem
  • 61
  • 1
  • 9