專家你好我有一個問題請求格式是無法識別爲URL意外結束
當我嘗試在本地機器上我的Web服務,它工作正常
但之後,我上傳它,並在運行託管服務器的Windows Server 2008 R2 asp.net 4.0
我得到這樣的請求格式的錯誤是無法識別的URL中/ setmylocation
意外結束我想這些解決方案
<system.webServer>
<handlers>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
<configuration>
<system.web>
<webservices>
<protocols>
<add name="HttpGet"></add>
<add name="HttpPost"></add>
</protocols>
</webservices>
</system.web>
</configuration>
and here is my client side code
$.ajax({
type: "POST",
url: "locations.asmx/setmylocation",
data: "{proid: '" + proid + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
var urloc = response.d;
if (urloc[0].LATITUDE == '') {
initializemap(14.001424154457723, 121.1032415625, 7);
} else {
initializemap(urloc[0].LATITUDE, urloc[0].LONGITUDE, 10);
}
},
failure: function (response) {
alert(response.d);
}
});
我什麼都試過,但問題仍然存在,希望得到答案的問題
謝謝
上面的圖片中顯示,其他Web服務調用就好
和錯誤來自elmah.axd
System.InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/setmylocation'.
at System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath)
at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
我想補充一點,其他2調用Web服務運行平穩 – angelogogo
我放棄了網絡服務功能,只是通過經度和緯度槽查詢字符串,我發現它更容易 – angelogogo
我和我的愚蠢我忘了創建必要的存儲過程被Web服務訪問終於得到它的工作 – angelogogo