I followed this example to create my 1st Owin web page
:
- Start VS2013, create C# project of Web application:
WebApplication1
. Tools->Nuget package manager->package manager console
PM> Install-Package microsoft.owin.host.SystemWeb
I can now see the owin reference. 3. Add->New Item->Owin startup class and enter code snippet:
using System;
using System.Threading.Tasks;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(WebApplication1.Startup1))]
namespace WebApplication1
{
public class Startup1
{
public void Configuration(IAppBuilder app)
{
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888
app.Run(context =>
{
context.Response.ContentType = "text/plain";
return context.Response.WriteAsync("Hello, world.");
});
}
}
}
OK, now I Ctrl+F5 to start, and it brings up an IE browser. Unluckily, the page shows there's some error inside the web application:
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
Most likely causes: •A default document is not configured for the requested URL, and directory browsing is not enabled on the server.
Things you can try: •If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists. • Enable directory browsing. 1.Go to the IIS Express install directory. 2.Run appcmd set config /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the server level. 3.Run appcmd set config ["SITE_NAME"] /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the site level.
•Verify that the configuration/system.webServer/directoryBrowse@enabled attribute is set to true in the site or application configuration file.
Detailed Error Information:
Module DirectoryListingModule
Notification ExecuteRequestHandler
Handler StaticFile
Error Code 0x00000000
Requested URL http://localhost:50598/
Physical Path D:\Documents\Visual Studio 2013\Projects\WebApplication1
Anonymous
Logon User Anonymous
Request Tracing Directory D:\Documents\IISExpress\TraceLogFiles\WEBAPPLICATION1
More Information: This error occurs when a document is not specified in the URL, no default document is specified for the Web site or application, and directory listing is not enabled for the Web site or application. This setting may be disabled on purpose to secure the contents of the server. View more information »
So is there anything I missed or wrongly committed in all my steps? How to make it work?
Windows Features -> Internet Information Services -> World Wide Web Services -> Application Development Features -> ASP.NET x.x
. – RB.