当我试图在Windows Phone 8.1中注册一个后台任务时,这个示例http://code.msdn.microsoft.com/windowsapps/Tile-Update-every-minute-68dbbbff 我收到了这个错误:
类未注册(HRESULT异常:0x80040154(REGDB_E_CLASSNOTREG))
我用这个代码:
Dim taskBuilder As New BackgroundTaskBuilder()
taskBuilder.Name = taskName
taskBuilder.TaskEntryPoint = taskEntryPoint
taskBuilder.SetTrigger(New SystemTrigger(SystemTriggerType.UserPresent, False))
taskBuilder.Register()
Run Code Online (Sandbox Code Playgroud)
有什么帮助吗?
我正在尝试使用 AAD 对我的客户端进行身份验证,并使用 Windows 服务自动执行此操作。在 AAD .NET SDK 中,有两种方法AcquireTokenAsync和AcquireToken,但我不能使用这两种方法中的任何一种,等待调用将永远停留而没有响应,当我执行以下操作时:
result = authContext.AcquireTokenAsync(resourceHostUri, clientId, new UserCredential(hardcodedUsername, hardcodedPassword)).Result;
Run Code Online (Sandbox Code Playgroud)
该对象返回状态Waiting for Activation& Code 31..
现在,是否可以使用硬编码的用户名和密码获取令牌?
我的完整代码:
string hardcodedUsername = "username";
string hardcodedPassword = "password";
string tenant = "tenantId@onmicrosoft.com";
string clientId = "clientId";
string resourceHostUri = "https://management.azure.com/";
string aadInstance = "https://login.microsoftonline.com/{0}";
string authority = String.Format(CultureInfo.InvariantCulture, aadInstance, tenant);
authContext = new AuthenticationContext(authority);
AuthenticationResult result = null;
try
{
result = authContext.AcquireTokenAsync(resourceHostUri, clientId, new UserCredential(hardcodedUsername, hardcodedPassword)).Result;
}
catch (Exception …Run Code Online (Sandbox Code Playgroud)