[英]How do I diagnose why an asp.net MVC site works on one server but not another?
I have a asp.net MVC with Razor site that works fine on my PC and our company's test server. 我有一个带有Razor站点的asp.net MVC,可以在我的PC和我们公司的测试服务器上正常工作。 However, on the client's web server it gets "stuck" on the login page.
但是,在客户端的Web服务器上,它会在登录页面上“卡住”。 I can't debug the site on the client's server (they don't have Visual Studio) and I can't duplicate the problem anywhere else.
我无法在客户端服务器上调试站点(它们没有Visual Studio),并且无法在其他任何地方重复该问题。 Any suggestions on how to find the problem?
关于如何找到问题的任何建议? Also, any idea what the problem might be?
另外,任何想法可能是什么问题?
So I have a login page where the user enters their user name and password and clicks a "sign in" submit button. 因此,我有一个登录页面,用户在其中输入他们的用户名和密码,然后单击“登录”提交按钮。 When they click submit, the browser gets "stuck";
当他们单击提交时,浏览器被“卡住”; that is the the "working" icon spins (I'm using Chrome) while at the bottom of the page it shows the message "waiting on {site name}...".
即“正在运行”图标旋转(我正在使用Chrome),而在页面底部则显示消息“正在等待{site name} ...”。
Here's some code from the view: 这是视图中的一些代码:
@using (Html.BeginForm("Login", "Admin", FormMethod.Post))
{
<label>
<b>Username</b>
</label>
@Html.TextBoxFor(m => m.UserName, new { @class = "span12" })
<span class="validation">@Html.ValidationMessageFor(m => m.UserName)</span>
<label>
<b>Password</b>
</label>
@Html.PasswordFor(m => m.Password, new { @class = "span12" })
<input id="Submit1" type="submit" value="Sign In" class="btn btn-primary pull-right" />
}
Here's a portion of the controller. 这是控制器的一部分。 I left out some error handling, but you'll get the idea that it's a simple "check if username and password exists" operation.
我省略了一些错误处理,但是您会发现这是一个简单的“检查用户名和密码是否存在”操作。
[HttpPost]
public ActionResult Login(ModelAdminLogin Model)
{
if (ModelState.IsValid)
{
LoginResponse Res = obj_bllCA.Login(Model.UserName, Model.Password);
if (Res.LoginStatus)
{
return RedirectToAction("Index");
}
}
return View(Model);
}
On the login page, after enter login information and clicking sign in, it "spins" for a few minutes and then shows a page not found message: 在登录页面上,输入登录信息并单击登录后,它“旋转”几分钟,然后显示“找不到页面”消息:
Strangely, if you then click refresh, it shows the correct page with the user logged in. 奇怪的是,如果您单击刷新,则会显示用户已登录的正确页面。
Again, on my PC in Visual Studio and my company's web server, the login process works fine. 同样,在Visual Studio的PC和公司的Web服务器上,登录过程可以正常进行。 The user enters the username and password, clicks Sign In, and it takes them to the next page.
用户输入用户名和密码,单击“登录”,然后将它们带到下一页。 Only on the client's server does it instead go to the missing page.
仅在客户端的服务器上,它才转至缺少的页面。
UPDATE #1 更新#1
Using Fiddler, I got this error message to display: 使用Fiddler,我得到此错误消息显示:
ReadResponse() failed: The server did not return a complete response for this request. ReadResponse()失败:服务器未对此请求返回完整的响应。 Server returned 0 bytes.
服务器返回了0个字节。
Using the Chrome tools, I can see it stalls after the submit button is clicked: 使用Chrome工具,单击提交按钮后,它会停滞:
It looks like it's not posting to the controller. 好像没有发布到控制器。 Anyone have a suggestion on how to fix this?
有人对如何解决这个问题有建议吗?
How do I diagnose why an asp.net MVC site works on one server but not another?
我如何诊断为什么一个asp.net MVC站点可以在一台服务器上运行而不能在另一台服务器上运行?
Using chrome dev tools you can diagnose why something isn't working: 使用chrome开发工具,您可以诊断为什么某些功能无法正常工作:
Internal server error: (In this case a 500 internal server error) 内部服务器错误:(在这种情况下为500个内部服务器错误)
You can click on the specifc request and then click the preview to get the details: 您可以单击特定的请求,然后单击预览以获取详细信息:
Based on ReadResponse error, it seems like it is an IIS configuration issue: 基于ReadResponse错误,似乎是IIS配置问题:
In general: 一般来说:
The answer turned out to be that the client had set up the site in IIS to be a secure site. 答案是,客户端已在IIS中将站点设置为安全站点。 I had to use https://sitename.com instead of sitename.com or http://sitename.com .
我必须使用https://sitename.com而不是sitename.com或http://sitename.com 。 Once I did that, all the pages worked.
一旦完成该操作,所有页面都将起作用。 I don't understand why the original page worked without the https or why hitting refresh showed the correct page without the https, so if anyone has any input on that please let me know.
我不明白为什么原始页面在没有https的情况下起作用,或者为什么单击刷新会显示没有https的正确页面,所以如果有人对此有任何输入,请告诉我。 Otherwise the https was the whole problem.
否则,https是整个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.