尝试与Unity进行Azure连接时获取&Quot;NotImplementedException(&Quot;NotImplementedException&Quot;)(c#) [英] Getting "NotImplementedException" when attempting Azure connection with Unity (c#)

查看:113
本文介绍了尝试与Unity进行Azure连接时获取&Quot;NotImplementedException(&Quot;NotImplementedException&Quot;)(c#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Unity 2019.3.6f1。我已经创建了一个简单的DLL,用于连接到Azure并上传文件。但是,当我调用此DLL尝试连接到Azure blob存储时,我得到以下堆栈跟踪:

NotImplementedException:方法或操作未实现。 System.Net.Http.HttpClientHandler.get_MaxConnectionsPerServer()(位于 <;7ebf3529ba0e4558a5fa1bc982aa8605>;:0) Azure.Core.Pipeline.ServicePointHelpers.SetLimits (System.Net.Http.HttpMessageHandler messageHandler)(位于 :0) Azure.Core.Pipeline.HttpClientTransport.CreateDefaultClient()(位于 :0) Azure.Core.Pipeline.HttpClientTransport..ctor()(在 :0) Azure.Core.Pipeline.HttpClientTransport..cctor()(位于 :0)重新抛出为 TypeInitializationException:的类型初始值设定项 "Azure.Core.Pipeline.HttpClientTransport"引发异常。 Azure.Core.ClientOptions..ctor()(位于 :0) Azure.Storage.Blobs.BlobClientOptions..ctor (Azure.Storage.Blobs.BlobClientOptions+ServiceVersion版本)(在 :0) Azure.Storage.Blobs.BlobServiceClient..ctor(System.String connectionString、Azure.Storage.Blobs.BlobClientOptions)(位于 :0) Azure.Storage.Blobs.BlobServiceClient..ctor(System.String connectionString)(位于:0) Cineon.UnityToAzureConnection+d__1.MoveNext()(位于 <;5252723c79f94a8cb77bb25e3b9f0396>;:0) -来自引发异常的前一位置的堆栈跟踪结束 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()(位于 <;437ba245d8404784b9fbab9b439ac908>;:0) System.Runtime.CompilerServices.AsyncMethodBuilderCore+<;>;c.b__6_0 (System.Object状态)(at<;437ba245d8404784b9fbab9b439ac908>;:0) UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke()(位于 :0) UnityEngine.UnitySynchronizationContext:ExecuteTasks()

以下是我的DLL代码(符合this Microsoft quickstart guide):

public class UnityToAzureConnection
{
    private readonly static string m_connectionString = "CENSORED";

    public static async void CreateConnection(string _path, string _fileName)
    {
        BlobServiceClient blobServiceClient = new BlobServiceClient(m_connectionString);
        BlobContainerClient containerClient = await blobServiceClient.CreateBlobContainerAsync("imagetest");

        BlobClient blobClient = containerClient.GetBlobClient(_fileName);
        using (FileStream _fs = File.Open(Path.Combine(_path, _fileName), FileMode.Open))
        {
            await blobClient.UploadAsync(_fs, true);
        }
    }
}
我只需调用此DLL的CreateConnection方法并传入";Application.dataPath";和一个文件名。但是,我随后得到了上述异常。

我已将所有其他需要的DLL从项目生成文件夹拉到插件文件夹,所以不确定为什么会发生这种情况。

如有任何帮助,我们将不胜感激。

请注意,我刚刚开始走出我的舒适区,所以我希望我的帖子符合StackOverflow的问题标准。

[附注]很明显,&censed";不是我的实际连接字符串,只是隐藏了敏感信息。

update 29/05/2021我已确认我的连接代码在简单的.Net控制台应用程序中使用时可以正常工作(但是,我必须将容器名称全部调整为小写)。此错误仅在Unity中发生。再次感谢您的帮助。

推荐答案

正如我在这里提到的,请尝试一次。 如果您有较低版本的Unity,请使用Azure.Core版本。1.19.0可能更好。

https://forum.unity.com/threads/attempting-to-connec-to-azure-blobs-results-in-notimplementedexception.1117705/

这篇关于尝试与Unity进行Azure连接时获取&Quot;NotImplementedException(&Quot;NotImplementedException&Quot;)(c#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆