级联下拉列表中的方法错误500 [英] Method Error 500 on cascading dropdownlist

查看:83
本文介绍了级联下拉列表中的方法错误500的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我用来从数据库中检索数据的Web服务(我为它使用了数据集)。它在IIS上运行正常但是当我在Web服务器上传它时它会给出方法错误500.

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

// 如果使用设计的组件,则取消注释以下行
// InitializeComponent();
}
[WebMethod]
public CascadingDropDownNameValue [] GetSchoolName( string knownCategoryValues, string category)
{
dsScoolTableAdapters.school_detailTableAdapter school_detailAdapter = new dsScoolTableAdapters.school_detailTableAdapter();
dsScool.school_detailDataTable schools = school_detailAdapter.GetSchoolName();
列表< CascadingDropDownNameValue> values = new List< CascadingDropDownNameValue>();
foreach(学校的DataRow博士)
{
string school_name =( string )dr [ school_name] ;
string district =( string )dr [ district] ;
值。添加(新CascadingDropDownNameValue(school_name,school_name.ToString())) ;
}
返回值.ToArray();
}


}

解决方案

500内部服务器错误是服务器端错误,这意味着问题不在于您的PC或Internet连接,而是网站服务器的问题。



在此处阅读有关错误500的信息: HTTP错误500内部服务器错误 [ ^ ]



此微软文章:网站管理员如何解决HTTP 500问题 - 内部服务器错误 [ ^ ]

如果有人像我显然对我一样愚蠢,问题是我遗漏了

 [System.Web.Script.Services。 ScriptServ我的网络服务声明中的

! D'哦!希望这会节省一些人我花在试图追踪问题上的时间。


如果出现此问题,大量数据会尝试更改参数

中的值web.config中的maxJsonLength 



 <   system.web.extensions  >  
< 脚本 >
< webServices >
< jsonSerialization maxJsonLength = 5000000 / >
< / webServices >
< / scripting >
< / system.web.extensions >





此解决方案见于 http://forums.asp.net/t/1038620.aspx/2/10 [ ^ ]


This is my web service which i used to retrieve data from database (I used data set for it).It runs on IIS properly but when I upload it on web server it gives method error 500.

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

        //Uncomment the following line if using designed components
        //InitializeComponent();
    }
    [WebMethod]
    public CascadingDropDownNameValue[] GetSchoolName(string knownCategoryValues, string category)
    {
        dsScoolTableAdapters.school_detailTableAdapter school_detailAdapter = new dsScoolTableAdapters.school_detailTableAdapter();
        dsScool.school_detailDataTable schools = school_detailAdapter.GetSchoolName();
        List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
        foreach (DataRow dr in schools)
        {
            string school_name = (string)dr["school_name"];
            string district = (string)dr["district"];
            values.Add(new CascadingDropDownNameValue(school_name, school_name.ToString()));
        }
        return values.ToArray();
    }


}

解决方案

The 500 Internal Server Error is a "server-side" error, meaning the problem is not with your PC or Internet connection but instead is a problem with the web site's server.

Read about Error 500 here: HTTP Error 500 Internal server error[^]

Also this microsoft article: How Web site administrators can troubleshoot an "HTTP 500 - Internal Server Error"[^]


In case anyone is as dumb as I apparently am for me the issue was that I left out

[System.Web.Script.Services.ScriptService]


in my web service declaration! D'oh! Hopefully this will save someone the time I spent trying to track down the issue.


In case this problem occurres with the large amount of data try change value in the parameter

maxJsonLength

in the web.config:

<system.web.extensions>
        <scripting>
            <webServices>
                <jsonSerialization maxJsonLength="5000000" />
            </webServices>
        </scripting>
    </system.web.extensions>



this solution was found in http://forums.asp.net/t/1038620.aspx/2/10[^]


这篇关于级联下拉列表中的方法错误500的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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