我创建了一个页面方法,它在localhost上工作正常,但在实时环境中却没有。 Jquery调用得到404错误页面作为回报。
Asp.net 4.0
本地IIS版本:7.5
Live IIS版本:7.0
示例实时网页:http://www.pricingindia.in/Store-Locator.aspx [只需分享执行该功能的位置]
本地主机屏幕截图:http://media-cache-ak0.pinimg.com/736x/bc/d0/06/bcd0061d03597873d3204040d64f4077.jpg
页面方法
[WebMethod]
public static string GetLocalStores(decimal lat, decimal lon)
{
return GetData(lat,lon).GetXml();
}
Jquery请求
function PullData() {
$.ajax({
type: "POST",
url: "Store-Locator.aspx/GetLocalStores",
data: '{lat: ' + latitude + ', lon: ' + longitude + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert(response.d);
},
error: function (response) {
alert(response.d);
}
});
}
网络配置
<system.web>
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
<authentication mode="Forms"/>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
<compilation debug="false" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
</system.web>