我们正在使用Asp.Net Core MVC开展Ionic项目。在存储库GetStoryCountForProfile()和SavedStoriesCountForProfileAsync()中调用了2个方法之后,应用程序使用了错误消息:当其调用表单Azure时发生了一个或多个错误。在本地,它没有任何错误。
我打电话给他们是这样的:response.ResultObject.MyStories = await _storyRepository.GetStoryCountForProfile(response.ResultObject.Profile.Id);
response.ResultObject.SavedStories = await _savedStoryRepository.SavedStoriesCountForProfileAsync(response.ResultObject.Profile.Id);
response.ResultObject.Followers = (await _followRepository.GetFollowersAsync(response.ResultObject.Profile.Id)).Number;
response.ResultObject.Following = (await _followRepository.GetFollowedAsync(response.ResultObject.Profile.Id)).Number;
存储库:
public async Task<int> GetStoryCountForProfile(int profileID)
{
int result = 0;
using (SqlConnection connection = new SqlConnection(ConnectionString))
{
SqlCommand command = SqlAccess.BuildCommand("StoryGetAllForProfile");
command.Parameters["@ProfileID"].Value = profileID;
DataTable datafromSQL = SqlAccess.ExecuteDataTable(command);
if (datafromSQL.Rows.Count > 0)
{
List<StoryEntity> stories = TableToObject.MapToList<StoryEntity>(datafromSQL);
return await Task.FromResult(stories.Count);
}
}
return await Task.FromResult(result);
}
public async Task<int> SavedStoriesCountForProfileAsync(int profileID)
{
int result = 0;
using (SqlConnection connection = new SqlConnection(ConnectionString))
{
SqlCommand command = SqlAccess.BuildCommand("GetSavedStoriesForProfile");
command.Parameters["@ProfileID"].Value = profileID;
DataTable datafromSQL = SqlAccess.ExecuteDataTable(command);
if (datafromSQL.Rows.Count > 0)
{
List<StoryEntity> stories = TableToObject.MapToList<StoryEntity>(datafromSQL);
return await Task.FromResult(result);
}
}
return await Task.FromResult(result);
}
如果我评论我称之为这两种方法的行,应用程序正在运行,或者在那里放任何数字。
我试图让它们同步,但没有解决问题。
我错过了什么?!
日Thnx