我有2个Web应用程序,它们共享相同的主级域,如下所述,所以我可以共享cookie.两个项目中的Web.conifg具有相同的机器密钥和验证密钥.因为,我想使用Identity和NOT表单认证,我的web.config文件中没有一个节点.我能够从SSO中成功创建Auth cookie,并且可以在SSO中查看授权页面,但是当我尝试访问MVC项目中的授权视图时,我仍然被重定向到SSO登录.
我在我的SSO和MVC项目中有一个startup.cs文件,如下所示:
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
// Enable the application to use a cookie to store information for the signed in user
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
ExpireTimeSpan = TimeSpan.FromMinutes(3),
LoginPath = new PathString("/Login"),
CookieName = "MyCookieName",
CookieDomain = ".domain.com"
});
app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);
AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.NameIdentifier;
} …Run Code Online (Sandbox Code Playgroud) 数据示例:
ID Name ParentID
1 parent-1 NULL
2 parent-2 NULL
3 sub 1
4 child-1-1 3
5 child-1-2 1
6 child-2-1 2
Run Code Online (Sandbox Code Playgroud)
现在如果我搜索名称'%child-1%',我想要以下记录:上面数据中的第1行,第3行,第4行和第5行.如果存储过程可以写什么样的返回我的行?
我的想法是如果我搜索文本,它将继续从表中选择记录,直到parentID为空.所以如果我喜欢搜索'child-1',基本的sql查询会返回Row-4和Row-5.但是我的程序在循环中检查了Row-4是否为parentid而非null,因此它得到一行ID = parentid的row-4为3.现在它得到一行ID = parentid of row-3是1并获得第1行.现在,row-1的parentd为NULL,因此它会停止.
我正在使用此存储过程在树视图中实现搜索功能,我希望在搜索后保留父子层次结构.
到目前为止,我已经尝试过这个,但我是存储过程的新手:
USE DBname
Go
DECLARE @ParentID int
Declare @myresultset Cursor
Set @myresultset = CURSOR for Select ParentID from mytable where Name like 'child-1%'
OPEN @myresultset
Fetch NEXT from @myresultset
into @ParentID
While @@Fetch_Status=0
Begin
While @ParentID is not NULL
Begin
Select @ParentID = ParentID from mytable where ID=@ParentID
Select …Run Code Online (Sandbox Code Playgroud) 我正在开发一个新的 ASP.NET MVC Web 应用程序,我看到所有页面都需要大约 12-15 秒才能加载,而不管控制器或视图中有什么。我有大约需要 8 秒的页面,除了 return View() 和在 html 中仅使用页面名称查看页面之外,控制器中没有代码。
我运行了 SQL Profiler 并且响应非常快,所以看起来 MVC 路由或其他东西一直在占用。到目前为止,我尝试了以下方法:
请让我知道 MVC 应用程序性能缓慢的原因可能是什么。
另一方面,对于大约有 150-250 个用户同时浏览的企业 Web 应用程序,我应该拥有的最佳服务器配置是什么,例如 CPU、处理器、RAM 等。
asp.net-mvc performance iis-7 asp.net-mvc-routing windows-server-2012