4

Using Visual Studio 2012:

  1. I created an "ASP.NET Empty Web Application" (using C#).
  2. I used NuGet to install the FubuMVC package.
  3. When I run the application (using IIS Express), I get the "Welcome to FubuMVC!" page which tells me to delete the FubuMVC.GettingStarted.dll file and to set the home page.
  4. So I do both of those things, implementing a HomeController that simply returns "Hello World" from Index.

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

What have I done wrong?

Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380

5 Answers5

2

try this cmd => don't forget to run as administrator

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

Wazzz
  • 195
  • 1
  • 11
1

Did you activate FubuMVC in your Global.asax? I usually see that error when there is no FubuMVC application.

So in Application_Start() (or whatever it's really called), you'll need something like:

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

Where you're telling it: 1.) What are the policies/conventions to use 2.) What's your IoC container

  • "ASP.NET Empty Web Application" projects don't have `Global.asax`. The FubuMVC NuGet package adds a `WebActivator.PreApplicationStartMethod` attribute pointing to `AppStartFubuMVC.Start`. – Roger Lipscombe Apr 15 '13 at 16:14
  • ...which runs successfully. This points at `ConfigureFubuMVC`, which also runs successfully. Basically, there's something missing from the NuGet packages and/or the documentation. – Roger Lipscombe Apr 15 '13 at 16:16
1

Usually if I run into this it's because I've got a conflict with a route and a folder in the project. For example, I might have a folder called 'Unit' and inside it I have a class called 'UnitEndpoint' with a method 'get_unit' (which should map to '/unit' as a route, assuming I'm using the FubuMVC defaults).

In that case, browsing to '/unit' will result in this error because IIS thinks I'm trying to list the contents of the 'Unit' folder. Renaming the endpoint or the folder to remove the conflict will fix it (e.g., renaming the 'Unit' folder to 'Units').

E.Z. Hart
  • 5,717
  • 1
  • 30
  • 24
1

Just tried reproducing your problem with a brand new project; it turns out that problem is that the instructions in the example haven't kept up with the changes in FubuMVC.

The instructions tell you to create a class called 'MyHomeController' and add the Index() method to it. This used to work, because one of the default rules for routes was to use any class with a name that ends in 'Controller'.

But the default has been changed in more recent versions, and the rule now looks for classes ending in 'EndPoint'.

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

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

E.Z. Hart
  • 5,717
  • 1
  • 30
  • 24
0

I suggest that you recompile your application or at least touch your global.asax -- looks like you need to rerun the App_Start method.

ulu
  • 5,872
  • 4
  • 42
  • 51