我对 simplegon 云示例有疑问。BasicPipeline 应用程序引发“使用 modeluri 的资产的 SPL 处理失败”,更准确地说是“请求的资源不支持 http 方法 'POST'”。worker.OnWorkFailed 异常。我的天蓝色连接设置接缝是正确的。但可能还有一些其他的 azure 设置可能不合适。
代码:
SimplygonCloudExamples.BasicPipeline
{
/// <summary>
/// A very simple pipeline.
///
/// Takes a few arguments, all URIs pointing to Azure Blob Storage files/folders:
/// ModelUri: Should point to a single asset on the azure blob storage of compatible format.
/// SplUri: Should point to a single SPL file on the azure blob storage.
/// OutputUri: Should point to a Azure Blob Storage folder with writing permissions.
///
/// Outputs progress percentage to console.
/// </summary>
class BasicPipelineProgram
{
// This method sets all the needed arguments to get running.
static void SetSettingsManuallyInCode()
{
// The model to process
Settings.Set("ModelUri", Settings.BlobStorageBasePath + Settings.BlobStorageContainerName + @"/Input/teapot.obj");
// The SPL to use
Settings.Set("SplUri", Settings.BlobStorageBasePath + Settings.BlobStorageContainerName + @"/SPLs/reduction_example_2018-07-2--17-02-03.spl");
// The output location
Settings.Set("OutputUri", Settings.BlobStorageBasePath + Settings.BlobStorageContainerName + @"/Output");
}
static void Main(string[] args)
{
// make sure we serialize materials correctly (numbers should use . not ,)
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
Settings.SetCommandLineArgs(args);
SetSettingsManuallyInCode();
System.IO.FileInfo splFile = new AzureFile(Settings.AzureConnectionString, Settings.GetAsUri("SplUri")).DownloadToLocalTempFile();
// Make sure we have all the arguments we need for this basic pipeline example
// Initialize the Cloud API
API.SimplygonCloudAPIBaseURL = Settings.SimplygonCloudAPIBaseURL;
API.SimplygonCloudAPIKey = Settings.SimplygonCloudAPIKey;
Worker worker = new Worker();
List<Uri> textureUris = Settings.GetAsUriList("TextureUris");
string sasToken = AzureUtility.GetSasToken_ReadWrite(Settings.AzureConnectionString, Settings.BlobStorageContainerName);
// Do the pipeline work
var SPLWork = new SPLProcessingWork(
assetPost: new AssetPost(Settings.GetAsUri("ModelURI"), sasToken),
splPost: new SPLPost(Settings.GetAsUri("SplUri"), sasToken),
storageContainerSasToken: sasToken,
outputUri: Settings.GetAsUri("OutputUri"),
onProcessingProgress: (asset, job) =>
{
// Note: this is in another thread, but Console.WriteLine handles concurrency for us
Console.WriteLine("Job Status: " + job.Status + (job.Status == JobStatus.Processing ? ", Processing progress: " + (job.ProgressPercentage).ToString("0") + "%" : ""));
},
processingSettings: new ProcessingSettings()
{
OutputFileName = "bob"
}
);
worker.OnWorkFailed = (workThatFailed, exception) =>
{
if (workThatFailed is SPLProcessingWork)
{
Console.WriteLine("SPL processing failed for asset with modeluri: " + (workThatFailed as SPLProcessingWork).AssetPost.ModelUri);
}
worker.Stop();
};
worker.ScheduleWork(SPLWork);
worker.Start();
foreach(var outAsset in SPLWork.OutputAssets)
{
AzureFile outFile = new AzureFile(Settings.AzureConnectionString, outAsset.ModelUri);
System.IO.FileInfo downloaded = outFile.DownloadToLocalTempFile();
Console.WriteLine(downloaded.FullName);
}
// Run until we have finished
Console.WriteLine("Done! Press enter to quit.");
Console.ReadLine();
}
}
}