Android Azure:404尝试从服务器检索数据时出错

时间:2015-02-24 12:07:45

标签: java android azure azure-sql-database azure-mobile-services

我正在尝试访问我的Azure数据库中的表并且代码很好(我相信或看起来如此)但是当尝试从服务器检索表数据时,它会返回一个带有异常的“404代码” :

java.util.concurrent.ExecutionException: com.microsoft.windowsazure.mobileservices.MobileServiceException: {'code': 404}

这是我的代码:

if (isInternetConnected == true) {
                new AsyncTask<Void, Void, Void>() {
                    @Override
                    protected Void doInBackground(Void... params) {
                        try {
                            //ActivityContent is the column I'm trying to retrieve from
                            final MobileServiceList<ActivityTable> result = mToDoTable.select("ActivityContent").execute().get();
                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {


                                    for (ActivityTable item : result) {

                                        Toast.makeText(getBaseContext(), item.getActivity(), Toast.LENGTH_LONG).show();
                                    }
                                }
                            });
                        } catch (Exception exception) {
                            Log.d("AZURE_Error", exception.toString());
                            Toast.makeText(getBaseContext(), exception.toString(), Toast.LENGTH_LONG).show();
                        }
                        return null;
                    }
                }.execute();
            }

1 个答案:

答案 0 :(得分:0)

我今天也遇到了这个错误。我直接在数据库中创建了一个表,但这不起作用。

经过几个小时的挫折,我发现使用.NET后端设置我的移动服务是我的问题。在使用javascript后端重新创建移动服务后,我终于可以访问我一直在阅读的传说中的DATA选项卡,并且我能够在那里创建表。一旦在那里创建了表,这个错误就消失了,一切都开始了。