Asp.Net Ajax WebService和内部错误500 [英] Asp.Net Ajax WebService and Internal Error 500

查看:108
本文介绍了Asp.Net Ajax WebService和内部错误500的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I can call the webservie directly to the browser with the following URL and it returns be all what I want :

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

当我像这样将其添加到Default.aspx页面的autocompleteexetender中时:

When I add it to an autocompleteexetender into the Default.aspx page like that :

<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" 
                  TargetControlID="TextBox1" 
                  runat="server" 
                  ServiceMethod="GetCompletionList" 
                  ServicePath="http://localhost:64438/MySearchAutoComplete.asmx" 
                  CompletionSetCount="12"
                  MinimumPrefixLength="1" />

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

The page load, I have a textbox but I have an error 500 every time I add a keystroke in the textbox. I see the error in the FireFox FireBug.

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

->这是错误

有什么主意吗?我已经注意到我需要附加该流程来调试Web服务,我是否也可能对此做错了?

Any idea? I have noticed that I need to attach the process to debug the webservice, I might do something wrong with it too?

如果我进入机器的事件查看器.我可以看到:

If I go to the Event Viewer of my machine. I can see :

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: MTL\daok 
    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.

I also have to start the webservice project first, than I stop it and start the webproject to be able to have both. The webservice still works (I can fire it directly http://localhost:64438/MySearchAutoComplete.asmx?op=GetCompletionList) but on the webpage I still have that Error 500.

添加到webservice项目web.config:

Adding to the webservice project web.config:

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

没有解决问题.

从WebService调用Page_Load()相同的方法效果很好:

Calling in the Page_Load() the same method from the WebService work very well:

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

但是它不能与AutoCompleteExtender一起使用...

But it's not working with the AutoCompleteExtender...

推荐答案

在网络服务器(即您的本地计算机)上的事件日志中,它应该给出更详细的错误消息.

In the event log on the webserver (i.e. your local machine) it should give a more detailed error message.

将此添加到我认为的web.config

Add this to your web.config I think

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

这篇关于Asp.Net Ajax WebService和内部错误500的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆