大佬教程收集整理的这篇文章主要介绍了为什么Ajax脚本未在IIS 7.5 Win 2008 R2服务器上运行?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
完整的答案分散在关于OP问题的评论中,但我认为这对我们有最大的帮助:
我有一个Web应用程序,可以在开发服务器上的VS 2013上正常运行,但是一旦在IIS 7.5 2008
R2服务器上发布了该Web应用程序,位于自定义脚本文件中的Ajax脚本就无法使用了,尽管其他JQuery脚本也是如此不调用Ajax的设备可以正常工作。为了使ajax在服务器中工作,还有其他需要做的事情吗?我已经阅读了一些有关的信息,但尚未找到答案。我在IIS和Ajax方面的经验有限。
//更新:
我已经弄清楚了Ajax脚本可以工作,并且该问题很可能在以下行中出现:
“ url:’/ Home / GetRates’,//请求的URL”
使用调试器,我发现虽然在本地(在VS
2013下)开发服务器中,但未在远程服务器中调用GetRates()函数。我看到的唯一区别是路径,但不知道如何解决。下面是Ajax脚本:
// Retrieve rates and @R_674_9531@e partial view
$(function () {
$('#reservSearch').submit(function () {
if ($(this).valid()) {
$("#theModal").modal("show"); // Display the in progress.....
$.ajax({
url: '/Home/GetRates',// URL for the request
data: $("#reservSearch").serialize(),// the data to send (will be converted to a query String)
type: "POST",// whether this is a POST or get request
dataType: 'html',// the type of data we expect BACk
success: function (data) { // code to run if the request succeeds; The response is passed to the function
$("#theModal").modal("hide"); // Close the in progress modal.....
$('#ratesView').html(data); // Fill div with results
},error: function (xhr,status) { // code to run if the request fails; the raw request and status codes are passed to the function
$("#theModal").modal("hide"); // Close the in progress modal.....
alert('Error: Retrieving parking rates' + "</br>" + xhr.error);
}
});
}
// // it is important to return false in order to cancel the default submission of the form and perform the AJAX call
return false;
});
});
//第二次更新
在遵循注释部分中的指示之后,这是来自ajax调用的响应:
<div id="header"><h1>Server Error in Application "DEFAULT WEB SITE"</h1></div>
<div id="server_version"><p>Internet Information services 7.5</p></div>
<div id="content">
<div class="content-container">
<fieldset><legend>Error SumMary</legend>
<h2>http Error 404.0 - Not Found</h2>
<h3>The resource you are looking for has been removed,had its name changed,or is temporarily unavailable.</h3>
</fieldset>
</div>
<div class="content-container">
<fieldset><legend>Detailed Error Information</legend>
<div id="details-left">
<table border="0" celLPADding="0" cellspacing="0">
<tr class="alt"><th>Module</th><td>IIS Web Core</td></tr>
<tr><th>Notification</th><td>MaprequestHandler</td></tr>
<tr class="alt"><th>Handler</th><td>StaticFile</td></tr>
<tr><th>Error Code</th><td>0x80070002</td></tr>
</table>
</div>
<div id="details-right">
<table border="0" celLPADding="0" cellspacing="0">
<tr class="alt"><th>requested URL</th><td>http://localhost:80/Home/GetRates</td></tr>
<tr><th>Physical Path</th><td>C:\inetpub\wwwroot\Home\GetRates</td></tr>
<tr class="alt"><th>Logon Method</th><td>Anonymous</td></tr>
<tr><th>Logon User</th><td>Anonymous</td></tr>
</table>
<div class="clear"></div>
</div>
</fieldset>
</div>
<div class="content-container">
<fieldset><legend>Most likely causes:</legend>
<ul> <li>The directory or file specified does not exist on the Web server.</li> <li>The URL contains a typographical error.</li> <li>A custom filter or module,such as URLScan,reStricts access to the file.</li> </ul>
</fieldset>
</div>
<div class="content-container">
<fieldset><legend>Things you can try:</legend>
<ul> <li>Create the content on the Web server.</li> <li>Review the browser URl.</li> <li>Create a tracing rule to track failed requests for this http status code and see which module is calling SetStatus. For more information about creaTing a tracing rule for failed requests,click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul>
</fieldset>
</div>
<div class="content-container">
<fieldset><legend>Links and More Information</legend>
This error means that the file or directory does not exist on the server. Create the file or directory and try the request again.
<p><a href="http://go.microsoft.com/fwlink/?LinkID=62293&IIS70Error=404,0x80070002,7601">View more information »</a></p>
</fieldset>
</div>
</div>
</body>
</html>
以上是大佬教程为你收集整理的为什么Ajax脚本未在IIS 7.5 Win 2008 R2服务器上运行?全部内容,希望文章能够帮你解决为什么Ajax脚本未在IIS 7.5 Win 2008 R2服务器上运行?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。