C# 服务器响应AngularJS中的状态为500(内部服务器错误)
Js:C# 服务器响应AngularJS中的状态为500(内部服务器错误),c#,mysql,angularjs,web-services,C#,Mysql,Angularjs,Web Services,Js: $scope.GetLocationList = function () { var url = "/MasterSvc.asmx/GetAllLocationList"; var data = {}; var options = {}; $http.post(url, data, options).then(function (response) { var dbfsr = response.data.d; var Loc
$scope.GetLocationList = function () {
var url = "/MasterSvc.asmx/GetAllLocationList";
var data = {};
var options = {};
$http.post(url, data, options).then(function (response) {
var dbfsr = response.data.d;
var LocData = {};
$scope.LocData = dbfsr;
}).catch(
function (response) {
console.log('return code: ' + response.status);
});
};
<table class="table table-bordered table-hover"
style="width: 95%;font-size:12px" id="EmpTbl">
<tr>
<th>Location Code</th>
<th>Location Type</th>
<th>Location Name</th>
<th>Location Address</th>
<th>Contact Person</th>
<th>Contact No</th>
<th>Actions</th>
</tr>
<tr dir-paginate="loc in LocData|orderBy:sortKey:reverse|filter:search|itemsPerPage:10">
<td>{{loc.LocationCode}}</td>
<td>{{loc.LocationType}}</td>
<td>{{loc.LocationName}}</td>
<td>{{loc.LocationAddress}}</td>
<td>{{loc.ContactPerson}}</td>
<td>{{loc.ContactNo}}</td>
<td style="text-align: center">
<input type="button" class="btn btn-warning SelectLocation"
data-ng-click="GetLocationDetails(loc.LocationCode)"
value="View/Edit" id="SelectLocation" data-toggle="modal"
data-target="#myModal" />
</td>
</tr>
</table>
这是JS函数,在页面加载时调用initController()
HTML:
$scope.GetLocationList = function () {
var url = "/MasterSvc.asmx/GetAllLocationList";
var data = {};
var options = {};
$http.post(url, data, options).then(function (response) {
var dbfsr = response.data.d;
var LocData = {};
$scope.LocData = dbfsr;
}).catch(
function (response) {
console.log('return code: ' + response.status);
});
};
<table class="table table-bordered table-hover"
style="width: 95%;font-size:12px" id="EmpTbl">
<tr>
<th>Location Code</th>
<th>Location Type</th>
<th>Location Name</th>
<th>Location Address</th>
<th>Contact Person</th>
<th>Contact No</th>
<th>Actions</th>
</tr>
<tr dir-paginate="loc in LocData|orderBy:sortKey:reverse|filter:search|itemsPerPage:10">
<td>{{loc.LocationCode}}</td>
<td>{{loc.LocationType}}</td>
<td>{{loc.LocationName}}</td>
<td>{{loc.LocationAddress}}</td>
<td>{{loc.ContactPerson}}</td>
<td>{{loc.ContactNo}}</td>
<td style="text-align: center">
<input type="button" class="btn btn-warning SelectLocation"
data-ng-click="GetLocationDetails(loc.LocationCode)"
value="View/Edit" id="SelectLocation" data-toggle="modal"
data-target="#myModal" />
</td>
</tr>
</table>
位置码
位置类型
地点名称
地址
联系人
联系电话
行动
{{loc.LocationCode}
{{loc.LocationType}
{{loc.LocationName}
{{loc.LocationAddress}
{{loc.ContactPerson}}
{{loc.ContactNo}
这是HTML代码,其中paginate与ng repeat一样使用,也用于分页
我正在尝试使用Mysql数据库中的webService绑定该表。当数据库选择记录最多限制为240条时,它工作正常,但如果记录超过240条,则显示内部服务器错误500。如何解决这个问题。请找到屏幕和代码。谢谢。您需要增加配置中的最大大小 在web.config后端添加此代码
<httpRuntime maxRequestLength="52428800" executionTimeout="36000" />
即使你能越过这个门槛,这也不是一件好事。(web配置中有一个用于指定http消息大小的配置。)这仅仅是因为您一次就为客户端提供了太多的数据。请执行分页。请使用try catch
块捕获错误并进行适当处理。