0

Forge プラットフォームについて学習中です。私は現在、Kean Walmsley によって書かれた例 (Jigsawify) を使用しています。これは、私の目標を最も正確に説明しているからです。ファイルを Azure ストレージ アカウントから Forge にダウンロードする際に問題が発生しています。「HTTP ヘッダーの値の 1 つが正しい形式ではありません」というエラーが表示されます。私の質問は、コードで作業項目を作成するときに、HTTP プロトコルのトラブルシューティングをどのように行うのですか? ワークアイテムを表示するためにブレークポイントを設定することはできますが、HTTP ヘッダーのどこに欠陥があるのか​​、あるいはどこに欠陥があるのか​​を理解するほどの知識はありません。確認すべきワークアイテムの特定のプロパティはありますか? HTTP ステートメントを見つけることができれば、それをテストできますが、どこにあるのかわかりません。

それとも、私は完全にベースから外れていますか?

とにかくここにコードがあります。これは、キーンが書いたものの修正版です。

static void SubmitWorkItem(Activity activity)
    {
      Console.WriteLine("Submitting workitem...");

            CloudStorageAccount storageAccount =
                    CloudStorageAccount.Parse(Microsoft.Azure.CloudConfigurationManager.GetSetting("StorageConnectionString"));
        StorageCredentials crd = storageAccount.Credentials;

        CloudFileClient fileClient = storageAccount.CreateCloudFileClient();
        CloudFileShare ShareRef = fileClient.GetShareReference("000scrub");
        CloudFileDirectory rootDir = ShareRef.GetRootDirectoryReference();
        CloudFile Fileshare = rootDir.GetFileReference("3359fort.dwg");


    // Create a workitem

    var wi = new WorkItem()
    {
        Id = "", // Must be set to empty
        Arguments = new Arguments(),
        ActivityId = activity.Id
    };


    if (Fileshare.Exists())
    {
        wi.Arguments.InputArguments.Add(new Argument()
        {
            Name = "HostDwg", // Must match the input parameter in activity
            Resource = Fileshare.Uri.ToString(),
            StorageProvider = StorageProvider.Generic // Generic HTTP download (vs A360)
        });
    }

    wi.Arguments.OutputArguments.Add(new Argument()

    {
        Name = "Results", // Must match the output parameter in activity
        StorageProvider = StorageProvider.Generic, // Generic HTTP upload (vs A360)
        HttpVerb = HttpVerbType.POST, // Use HTTP POST when delivering result
        Resource = null, // Use storage provided by AutoCAD.IO
        ResourceKind = ResourceKind.ZipPackage // Upload as zip to output dir

    });

      container.AddToWorkItems(wi);
      container.SaveChanges();

      // Polling loop

      do
      {
        Console.WriteLine("Sleeping for 2 sec...");
        System.Threading.Thread.Sleep(2000);
        container.LoadProperty(wi, "Status"); // HTTP request is made here
        Console.WriteLine("WorkItem status: {0}", wi.Status);
      }
      while (
        wi.Status == ExecutionStatus.Pending ||
        wi.Status == ExecutionStatus.InProgress
      );

      // Re-query the service so that we can look at the details provided
      // by the service

      container.MergeOption =
        Microsoft.OData.Client.MergeOption.OverwriteChanges;
      wi = container.WorkItems.ByKey(wi.Id).GetValue();

      // Resource property of the output argument "Results" will have
      // the output url

      var url =
        wi.Arguments.OutputArguments.First(
          a => a.Name == "Results"
        ).Resource;

      if (url != null)
        DownloadToDocs(url, "SGA.zip");

      // Download the status report

      url = wi.StatusDetails.Report;

      if (url != null)
        DownloadToDocs(url, "SGA-Report.txt");
    }

どんな助けでも大歓迎です、チャック

4

2 に答える 2