Page Samples/jssample2.aspx
[WebMethod]
[System.Web.Script.Services.ScriptMethod()]
public static string HelloPage()
{
return "g"; }
}
The jQuery:
jQuery.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "http://myhost.com/Samples/jssample2.aspx/HelloPage",
data: "{}",
dataType: "json" });
Looks like my web service(asmx) is dis开发者_StackOverflow社区able( when i publish it to server) But i can go in my browser to Myhosting.com/jssample2.aspx/HelloPage (and i see default soap descriptio
In FIDDLER POST http://myhost.com/Samples/jssample2.aspx/HelloPage HTTP/1.1 Fiddler Response HTTP/1.1 404 Not Found jquery.ajax error also return 404. Maybe i ndee add something to web.config? or to my web pethods(attributes)? IIS SETTINGS .asmx D:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll My httpHandlers
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
</httpHandlers>
I just create simple solution and publish it to web server all works fine. Looks like problem was in path
problem was in web.config. i remove router settings an add in httpmodules section
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
精彩评论