asp.net – 可以将OWIN Nancy与Web Forms一起使用吗?
发布时间:2020-12-16 06:27:29 所属栏目:asp.Net 来源:网络整理
导读:我像这样定义Nancy类: public class DefNancy : NancyModule{ public DefNancy() : base("/nancy") { Get["/"] = _ = { var model = new { title = "Hello world" }; return View["home",model]; }; }} 在OWIN Startup类中: public class Startup{ public
我像这样定义Nancy类:
public class DefNancy : NancyModule { public DefNancy() : base("/nancy") { Get["/"] = _ => { var model = new { title = "Hello world" }; return View["home",model]; }; } } 在OWIN Startup类中: public class Startup { public void Configuration(IAppBuilder app) { var hubConfiguration = new HubConfiguration(); hubConfiguration.EnableDetailedErrors = true; app.MapSignalR(hubConfiguration); config = new HttpConfiguration(); config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute("def","api/{Controller}"); config.Formatters.Remove(config.Formatters.XmlFormatter); app.UseWebApi(config); app.UseNancy(); } } 但现在我的* .aspx和另一个页面返回404错误. 解决方法
用这个:
app.UseNancy(options => options.PerformPassThrough = context => context.Response.StatusCode == HttpStatusCode.NotFound); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net core webapi 服务端配置跨域的实例
- Asp.net core 2.2 的一些特点
- asp.net-mvc – ASP.NET MVC图像和其他静态内容url
- webapi 利用 ActionFilter 为 ASP.NET Web API 添加 GZip 压
- asp.net – 什么时候调用Application_End,我该如何手动导致
- asp.net – Facebook和G的自定义LINK共享URL
- 检测到在集成的托管管道模式下不适用的ASP.NET设置的解决方
- ASP.NET MVC3 AJAX.BeginForm AjaxOptions OnSuccess OnFai
- asp.net-mvc-3 – IIS中缺少UrlRoutingModule
- asp.net-mvc – 为什么人们在MVC中使用Web API控制器