Csharp/C#教程:Asp.Net Ajax WebService和内部错误500分享


Asp.Net Ajax WebService和内部错误500

我可以使用以下URL直接将webservie调用到浏览器,它将返回我想要的所有内容:

https://localhost:64438/MySearchAutoComplete.asmx/GetCompletionList 

当我将它添加到autocompleteexetender到Default.aspx页面时,如下所示:

  

页面加载,我有一个文本框但每次在文本框中添加击键时我都有一个错误500。 我在FireFox FireBug中看到了错误。

 https://localhost:62702/ --->This is the webpage that load fine 

alt text https://sofzh.miximages.com/c%23/1269451120-clip-2kb.png – >这是错误

任何的想法? 我注意到我需要附加调试webservice的过程,我也可能做错了吗?

编辑(事件查看器)

如果我去我的机器的事件查看器。 我可以看到 :

 Exception information: Exception type: InvalidOperationException Exception message: Request format is unrecognized for URL unexpectedly ending in '/GetCompletionList'. Thread information: Thread ID: 8 Thread account name: MTLdaok Is impersonating: False Stack trace: 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.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 

我还必须首先启动webservice项目,而不是停止它并启动webproject以便能够同时启动它们。 web服务仍然可以工作(我可以直接激活它:http:// localhost:64438 / MySearchAutoComplete.asmx?op = GetCompletionList )但是在网页上我还有错误500。

编辑2(Web.config)

添加到webservice项目web.config:

        

没有解决问题。

编辑3(直接电话)

在Page_Load()中调用WebService中的相同方法非常有效:

  string[] stuffs; stuffs = proxy.GetCompletionList("1", 10); MyList.DataSource = stuffs; MyList.DataBind(); 

但它不适用于AutoCompleteExtender ……

在Web服务器(即本地计算机)上的事件日志中,它应该提供更详细的错误消息。

把它添加到你的web.config我想

       

只需确保在Web服务类页面顶部的WebServiceBinding下面取消注释[System.Web.Script.Services.ScriptService]

那应该会解决它。 如果它仍然存在,请检查您的SitePath的URL,确保它正确根植于Web服务的位置,方法是在URL之前包含“〜”,如下所示:

上述就是C#学习教程:Asp.Net Ajax WebService和内部错误500分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!

 SitePath="~/Webservice.asmx" 

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/cdevelopment/955890.html

(0)
上一篇 2021年11月21日
下一篇 2021年11月21日

精彩推荐