I am working on labeling of documents using MIP SDK 1.7.133. The code is working fine in local machine and IIS (windows). But when I run the labeling code in Azure App Service, I get the following error:
"Message": "An error has occurred.", "ExceptionMessage": "SSL failure Inner exception: [http_exception: 'WinHttpSendRequest: 12030: The connection with the server was terminated abnormally'], 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": " at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n...
The code before failure:
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;
}
Would be glad to hear any thoughts. Thanks.