0

TableControllersを押すとモバイルサービスが正常に動作します。しかし、StorageControllerタイプのコントローラに必要なすべてのパラメータと設定をセットアップしても、それらのコントローラに接続することはできません。Azure Mobile Appサービス - StorageControllerルーティングが機能しない

我々はそれらの方法(例えば:https://myservice.azurewebsites.net/tables/New_Monitoring_Data/ {ID}/MobileServiceFile)をGET呼び出そうとしながら 我々は応答を以下の取得: あなたが探しているリソースが削除されている、その名が変更、または一時的に利用できませんでした。

これらのコントローラ上のルーティングが動作しているか、モバイルサービスでピックアップされている可能性があります。ここで

はアプリのスタートアップコンフィギュレーションです:私たちは(ポストマンを使用してみました - 要求を取得します)を呼び出すことができないストレージコントローラクラスの

new MobileAppConfiguration() 
     .MapApiControllers() 
     .AddTables(        // from the Tables package 
      new MobileAppTableConfiguration() 
       .MapTableControllers() 
       .AddEntityFramework()    // from the Entity package 
      ) 
     .ApplyTo(config); 

一つ

using System.Collections.Generic; 
using System.Net.Http; 
using System.Threading.Tasks; 
using System.Web.Http; 
using Microsoft.Azure.Mobile.Server.Files; 
using Microsoft.Azure.Mobile.Server.Files.Controllers; 
using FieldEngineer.DataObjects; 

namespace FieldEngineer.Controllers 
{ 
    [Authorize] 
    [RoutePrefix("tables/New_Monitoring_Data")] 
    public class New_Monitoring_DataStorageController : StorageController<New_Monitoring_Data> 
    { 
     [HttpPost] 
     [Route("{id}/StorageToken")] 
     public async Task<HttpResponseMessage> PostStorageTokenRequest(string id, StorageTokenRequest value) 
     { 
      StorageToken token = await GetStorageTokenAsync(id, value); 

      return Request.CreateResponse(token); 
     } 

     // Get the files associated with this record 
     [HttpGet] 
     [Route("{id}/MobileServiceFiles")] 
     public async Task<HttpResponseMessage> GetFiles(string id) 
     { 
      IEnumerable<MobileServiceFile> files = await GetRecordFilesAsync(id); 

      return Request.CreateResponse(files); 
     } 

     [HttpDelete] 
     [Route("{id}/MobileServiceFiles/{name}")] 
     public Task Delete(string id, string name) 
     { 
      return base.DeleteFileAsync(id, name); 
     } 
    } 
} 

答えて

2

あなたはでconfig.MapHttpAttributeRoutes();を行いましたスタートアップファイル?

+0

公共部分クラス起動 {公共静的ボイドConfigureMobileApp(IAppBuilderアプリ) {HttpConfiguration設定=新しいHttpConfiguration()。 config.EnableSystemDiagnosticsTracing();新しいモバイルアプリケーション構成() 。 Database.SetInitializer (null); app.UseWebApi(con​​fig); – glstephens08

+0

だからいいえ。 "新しいMobileAppConfiguration() .UseDefaultConfiguration() .ApplyTo(config);" – glstephens08

+0

私は一般に、MobileAppConfiguration()の前に置いています。私はそれが重要だとは思わない。 –

関連する問題