Exemplo n.º 1
0
        // The bootstrapper enables you to reconfigure the composition of the framework,
        // by overriding the various methods and properties.
        // For more information https://github.com/NancyFx/Nancy/wiki/Bootstrapper

        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
            CustomStatusCode.AddCode(400);
            CustomStatusCode.AddCode(401);
            CustomStatusCode.AddCode(404);
            CustomStatusCode.AddCode(500);

            CustomStatusCode.AllowIISErrors = true;

            base.ApplicationStartup(container, pipelines);
            container.Register <IProvider>(new Provider());

            Conventions.ViewLocationConventions.Clear();
            Conventions.ViewLocationConventions.Add((viewName, model, context) => string.Concat("Layout/", viewName));
            Conventions.ViewLocationConventions.Add((viewName, model, context) => string.Concat("Codes/", viewName));
            Conventions.ViewLocationConventions.Add((viewName, model, context) => string.Concat(context.ModuleName, "/", viewName));

            //pipelines.OnError += (ctx, err) => HandleExceptions(err, ctx); ;
        }
Exemplo n.º 2
0
 protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
 {
     CustomStatusCode.AddCode(404);
     //CustomStatusCode.AddCode(ConfigurationManager.AppSettings["HttpErrorCodes"].Split(',').Select(x => int.Parse(x)));
     base.ApplicationStartup(container, pipelines);
 }