0

我正在使用 MIP SDK 1.7.133 标记文档。该代码在本地机器和 IIS(Windows)中运行良好。但是当我在 Azure App Service 中运行标签代码时,我收到以下错误:

“消息”:“发生错误。”,“异常消息”:“SSL失败内部异常:[http_exception:'WinHttpSendRequest:12030:与服务器的连接异常终止'],CorrelationId = 56acdff3-ec61-4723-8bee -21ea49f27334, CorrelationId.Description=PolicyProfile, HttpRequest.Id={6187BC6B-FF2E-419C-BB8D-34B828B5C105}, HttpRequest.SanitizedUrl=https://dataservice.protection.outlook.com/PsorWebService/v1/ClientSyncFile/MipPolicies, NetworkError .Category=SSL", "ExceptionType": "Microsoft.InformationProtection.Exceptions.NetworkException", "StackTrace": " 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n
在 System.Runtime.CompilerServices.TaskAwaiter。HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n...

失败前的代码:

 public ProtectionManager(ProtectionParameters protectionParameters)
    {
        _appInfo = new ApplicationInfo()
        {
            ApplicationId = protectionParameters.ClientId,
            ApplicationName = protectionParameters.AppName,
            ApplicationVersion = protectionParameters.AppVersion
        };
        _protectionParameters = protectionParameters;
        _authDelegate = new AuthDelegateImplementation(_appInfo, _protectionParameters);
        var path = Path.Combine(
        Directory.GetParent(Path.GetDirectoryName(new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath)).FullName,
        Environment.Is64BitProcess ? "bin\\x64" : "bin\\x86");
        
        MIP.Initialize(MipComponent.File, path);
        
        Identity id = new Identity($"{_appInfo.ApplicationId}@{_protectionParameters.Tenant}");
        
        profile = CreateFileProfile(_appInfo);
        
        engine = CreateFileEngine(id);
    }

    private IFileProfile CreateFileProfile(ApplicationInfo appInfo)
    {
        string appPath = Path.GetDirectoryName(new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).AbsolutePath);
        mipContext = MIP.CreateMipContext(appInfo, Path.Combine(appPath,"mip_data"), Microsoft.InformationProtection.LogLevel.Trace, null, null);
        // Initialize file profile settings to create/use local state.                
        var profileSettings = new FileProfileSettings(mipContext, CacheStorageType.InMemory, new ConsentDelegateImplementation());            
        var profile = Task.Run(async () => await MIP.LoadFileProfileAsync(profileSettings)).Result;
        return profile;

    }

    private IFileEngine CreateFileEngine(Identity identity)
    {
                 
        var engineSettings = new FileEngineSettings(identity.Email, _authDelegate, "", "en-US")
        {                
            Identity = identity,                                                          
        };            
        **var engine = Task.Run(async () => await profile.AddEngineAsync(engineSettings)).Result;**
        return engine;
    }

很高兴听到任何想法。谢谢。

4

1 回答 1

0

昨天有人遇到这个问题,并提到更改目标 .NET 框架解决了这个问题。

在 Azure 中部署时出现 MIP SDK 错误 - SSL 失败内部异常:[http_exception: 'WinHttpSendRequest' CorrelationId.Description=PolicyProfile

您可以评论他的帖子以了解具体情况。获得详细信息后,我可以将其添加到我们的文档中:)

于 2020-11-12T23:30:37.913 回答