Visual Studio 2015를 사용하여 간단한 ASP.NET 핵심 응용 프로그램을 개발하고 로컬 컴퓨터에서 테스트했습니다. 모든 것은 기대에 따라 달리고있었습니다.게시 후 웹 응용 프로그램이 응답하지 않습니다.
FTP를 통해 내 웹 호스팅 서버에 업로드 한 후 갑자기 실제 페이지가 표시되지 않습니다.
내 말은 라우팅이 올바르게 작동하고 있다는 것을 알 수 있다는 것입니다 (원래 주소가 /App/Index
이지만 내가 알 수없는 이유로 응용 프로그램에 로그인하지 않았기 때문에 즉각 012B으로 이동했습니다. (I 페이지를 검사 아무것도) 빈 페이지를 참조하십시오
여기서 무엇이 잘못 될 수 있습니까? 내 견해가 앱에 제대로 주입되지 않은 이유는 무엇입니까?
EDIT 1 - 추가 정보 여기에
은 내위한 인증 방법은 다음과 같습니다
설정
services.AddIdentity<IP_User, IdentityRole>(config =>
{
config.User.RequireUniqueEmail = true;
config.Password.RequiredLength = 5;
config.Cookies.ApplicationCookie.LoginPath = "/Auth/Login";
config.Cookies.ApplicationCookie.Events = new CookieAuthenticationEvents()
{
OnRedirectToLogin = ctx =>
{
if ((ctx.Request.Path.StartsWithSegments("/api"))
&& ctx.Response.StatusCode == (int)HttpStatusCode.OK)
{
ctx.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
}
else
{
ctx.Response.Redirect(ctx.RedirectUri);
}
return Task.FromResult(0);
}
};
}).AddEntityFrameworkStores<ShoppingContext>();
Startup.cs에서와 AuthController 미만 :
public class AuthController : Controller
{
private SignInManager<IP_User> _signInManager;
public AuthController(SignInManager<IP_User> signInManager)
{
_signInManager = signInManager;
}
// GET: /<controller>/
public IActionResult Login()
{
if (User.Identity.IsAuthenticated)
{
return RedirectToAction("Index", "App");
}
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Login(LoginViewModel vm, string ReturnUrl)
{
if (ModelState.IsValid)
{
var result = await _signInManager.PasswordSignInAsync(vm.Username, vm.Password, true, false);
if (result.Succeeded)
return RedirectToAction("Index", "App");
else
ModelState.AddModelError("", "Username or Password incorrect.");
}
return View();
}
public async Task<IActionResult> Logout()
{
if (User.Identity.IsAuthenticated)
{
await _signInManager.SignOutAsync();
}
return RedirectToAction("Login", "Auth");
}
}
을 어디 IP_User
그냥 상속 된 IdentityUser
로컬 IIS 인스턴스에서 VS를 호스팅하지 않으셨습니까? –
아니, 지난 시간에 작동하지 못하게 설정하는 방법을 찾지 못했습니다. –
원격 웹 호스트를 사용하기 전에 먼저 로컬로 배포하는 방법을 찾는다면 문제를 해결하기가 더 쉬울 것 같아요. . 마지막으로 로컬로 설정하려고 시도했을 때 - 정확히 동일하게 작동 했습니까? –