2015-04-01 97 views
1

我正面临与Web服务调用相关的一个问题。它在我的本地机器上运行得非常好。但是一旦我将其部署在Web(IIS 7)服务器上并试图进行服务调用,那么此时它将引发404(资源未找到)错误。Web服务(.asmx)在IIS 7中引发404错误

对于您的实物信息,我已将服务保留在Web服务器上的正确位置,我也检查了它的权限也没问题。 为了您的提示,jsdebug没有得到在网络服务器上创建 例如: 如果我把我的本地机器的url http://localhost:8080/Service.asmx/jsdebug然后jsdebug带有下载选项,但是当我把相同的网络服务器,然后错误即将到来:

“404 - 文件或目录未找到。 您正在查找的资源可能已被删除,更名或暂时不可用。

请推荐

回答

0

此问题已得到解决。当我们遇到这个问题时,我们正在更新我们的应用程序DNN 7.3。此场景中的解决方案是从DNN提供的webconfig中删除路由协议

非常感谢您的回复我appriciate它。

0

试试这个:

JS

$.ajax({ 
     type: "POST", 
     url: 'WebService.asmx/YourMethod', 
     data: {}, 
     async: false, 
     contentType: "application/json; charset=utf-8", 
     success: function (result) { 
       alert(result.d); 
     }, 
     failure: function (error) { 
     } 
    }); 

ASMX

[WebService(Namespace = "http://tempuri.org/")] 
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] 
[System.ComponentModel.ToolboxItem(false)] 
[System.Web.Script.Services.ScriptService] 
[Serializable] 
public class WebService : System.Web.Services.WebService 
{ 

      [WebMethod] 
      public string YourMethod() 
      { 
        return "OK"; 
      } 
} 

WebConfig(内部的System.Web标签)

<webServices> 
    <protocols> 
     <add name="HttpGet"/> 
     <add name="HttpPost"/> 
    </protocols> 
    </webServices>