答案 0 :(得分:0)
查看previous version of the WebExceptionStatus
enumeration时,PCL不支持NameResolutionFailure
成员。
您可以采取的措施如下:
case (System.Net.WebExceptionStatus)1:
// your code
或者:
catch (System.Net.WebException ex)
{
if ((int)ex.Status == 1)
// your code
)
我通过简单地抛出一个新的WebException
来测试这个:
throw new System.Net.WebException("Test", (System.Net.WebExceptionStatus)1);
正如我所想的那样,NameResolutionFailure
为StatusCode
时返回了一个例外。