使用jquery json自动完成内部服务器错误500?

m4pnthwp  于 2021-06-30  发布在  Java
关注(0)|答案(1)|浏览(271)

用jquery json和c#自动完成:程序在本地工作,但在服务器上不工作。为什么?

[WebMethod]

public List<string> GetAutoCompleteData(string prefixText)
{ 

...

错误如下:
内部服务器错误500
还有这个错误:
“/”应用程序中存在服务器错误。
未知的web方法GetAutoCompletedData。参数名称:methodname
描述:执行当前web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误的详细信息以及错误在代码中的起源。
异常详细信息:system.argumentexception:未知的web方法GetAutoCompletedData。参数名称:methodname
源错误:
在执行当前web请求期间生成了未处理的异常。有关异常的起源和位置的信息可以使用下面的异常堆栈跟踪来标识。
堆栈跟踪:
[argumentexception:未知的web方法GetAutoCompletedData。参数名称:methodname]
system.web.script.services.webservicedata.getmethoddata(字符串methodname)+539974
system.web.script.services.resthandler.createhandler(webservicedata webservicedata,string methodname)+10
system.web.script.services.resthandler.createhandler(httpcontext上下文)+159
system.web.script.services.resthandlerfactory.gethandler(httpcontext上下文,字符串请求类型,字符串url,字符串路径)+62
system.web.script.services.scripthandlerfactory.gethandler(httpcontext上下文,字符串请求类型,字符串url,字符串路径)+47
system.web.materialehandlerexecutionstep.system.web.httpapplication.iexecutionstep.execut e()
+334 system.web.httpapplication.executestep(iexecutionstep step,boolean&同步完成)+184
版本信息:microsoft.net frameworkversion:4.0.30319; asp.netversion:4.0.30319.272

dgtucam1

dgtucam11#

好了,现在我们有进展了。
如果我理解正确的话,您已经在asmx文件中的asp.net网站中实现了一个webmethod(这也是我们在其中一个产品中所做的)。为了让它在iis中正常工作(在开发环境中工作正常),您需要将iis配置为允许.asmx页面(添加处理程序Map)。您可以直接在iis配置或web.config中执行此操作。
这里还有一个问题可供参考:
asmx服务在开发服务器上工作,部署到iis7.5时返回404
不管赏金的事。不同的问题:)

相关问题