简体   繁体   English

由于其保护级别,无法访问Azure StorageException

[英]Azure StorageException is inaccessible due to its protection level

Looks like something wrong with my VS2013, because this code: VS2013似乎有问题,因为此代码:

try
{
    TableResult tblr = await cloudTable.ExecuteAsync(...);
}
catch ( StorageException ex )
{
    Debug.WriteLine( ex.Message );
}

Gives me this error: 给我这个错误:

Microsoft.WindowsAzure.Storage.StorageException is inaccessible due to its protection level Microsoft.WindowsAzure.Storage.StorageException由于其保护级别而无法访问

Everything else is working well in this windows store project . windows store project其他所有内容都运行良好。 It even works in the console application , that use almost the same azure code ( StorageException works well in the console application). 它甚至在console application ,使用几乎相同的天蓝色代码( StorageException行之有效的控制台应用程序)。

Any ideas what can be wrong? 有什么想法可能是错误的吗? I tried to reinstall Azure Sdk 2.5, delete ComponentModelCache folder in VS2013 - nothing helped. 我试图重新安装Azure Sdk 2.5,删除VS2013中的ComponentModelCache文件夹-没有任何帮助。

Update : I'm not 100% sure, but Azure library code declares StorageException in this way: 更新 :我不确定100%,但是Azure库代码以这种方式声明 StorageException:

#if WINDOWS_RT || ASPNET_K
    internal class StorageException : COMException
#else
    public class StorageException : Exception
#endif

It's looks like Windows Store app is the same as WINDOWS_RT . 看起来Windows Store应用程序与WINDOWS_RT相同。

Azure Storage Client Library for Windows Runtime does not expose the StorageException type, because Windows Runtime components are not allowed to declare public exception types (see Throwing exceptions for more information). Windows Runtime的Azure存储客户端库不公开StorageException类型,因为不允许Windows Runtime组件声明公共异常类型(有关详细信息,请参阅抛出异常 )。

You can instead pass in an OperationContext object and then check its LastResult . 您可以改为传入OperationContext对象,然后检查其LastResult

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM