Patrick Desjardins Patrick Desjardins -4 years ago 88
ASP.NET (C#) Question

Asp.Net Ajax WebService and Internal Error 500

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


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

<cc1:AutoCompleteExtender ID="AutoCompleteExtender1"
MinimumPrefixLength="1" />

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

alt text --> This is the error

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

Edit (Event Viewer)

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)

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.

Edit 2 (Web.config)

Adding to the webservice project web.config:

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

Have not solve the problem.

Edit 3 (Direct call)

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

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

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

Answer Source

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

Add this to your web.config I think

        <add name="HttpGet"/>
        <add name="HttpPost"/>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download