The web server is configured to not display the contents of this directory

Using Visual Studio 2012:

  • I created an "Empty ASP.NET Web Application" (using C #).
  • I used NuGet to install the FubuMVC package.
  • When I run the application (using IIS Express), I get β€œWelcome to FubuMVC!”, Which says that I delete the FubuMVC.GettingStarted.dll file and set the home page.
  • So, I do both of these things by implementing a HomeController that simply returns "Hello World" from the Index .

Instead of the expected "Hello World", I get an IIS error: The Web server is configured to not list the contents of this directory.

What I did wrong?

+4
source share
5 answers

Just tried to reproduce your problem with a completely new project; it turns out that the problem is that the instructions in this example were not saved with the changes in FubuMVC.

In the instructions, you are prompted to create a class called "MyHomeController" and add the Index () method to it. This worked because one of the default rules for routes was to use any class with a name that ends with "Controller".

But the default value has been changed in later versions, and now the rule is looking for classes ending in "EndPoint".

So, if you change the class name from "MyHomeController" to "MyHomeEndpoint", it should work.

Also, remember that the application pool must be restarted for the new configuration to take effect, so you will have to touch your web.config (or force restart IISExpress).

+1
source

try this cmd => do not forget to run as administrator

% windir% \ Microsoft.NET \ Framework64 \ v4.0.30319 \ aspnet_regiis.exe -ir

+2
source

Have you activated FubuMVC in your Global.asax? I usually see this error when there is no FubuMVC application.

So, in Application_Start () (or something else that it really calls) you need something like:

FubuApplication.DefaultPolicies (). StructureMap (new Container ()). Bootstrap ();

Where do you say: 1.) What policies / agreements to use 2.) What is your IoC container

+1
source

Usually, if I come across this, because I have a conflict with the route and folder in the project. For example, I might have a folder called "Unit", and inside it there is a class called "UnitEndpoint" with the get_unit method (which should map to "/ unit" as a route, assuming I use the default values ​​of FubuMVC).

In this case, browsing in '/ unit' will result in this error because IIS thinks I'm trying to list the contents of the Unit folder. Renaming an endpoint or folder to remove the conflict will eliminate it (for example, rename the Unit folder to Units).

+1
source

I suggest you recompile your application or at least touch your global.asax - it seems you need to re-run the App_Start method.

0
source

All Articles