I always get the below exception when calling Azure ADB2C using MSAL 2.2.0 below is the code snippet and the exception received. Note that all nuget packages are up-to-date and nothing required update
PublicClientApplication PCA = new PublicClientApplication(BL.Constants.ClientID, BL.Constants.Authority);
PCA.RedirectUri = BL.Constants.RedirectUri;
try
{
//IEnumerable<IAccount> accounts = await PCA.GetAccountsAsync();
//var authenticationResult = await PCA.AcquireTokenAsync(BL.Constants.Scopes, new UIParent(this.Activity));
var authenticationResult = await PCA.AcquireTokenAsync(
BL.Constants.Scopes,
"",
UIBehavior.SelectAccount,
"",
null,
BL.Constants.Authority,
new UIParent(this.Activity));
}
catch (MsalException ex)
{
if (ex.Message != null && ex.Message.Contains("AADB2C90118"))
{
//await OnForgotPassword();
}
if (ex.ErrorCode != "authentication_canceled")
{
//await DisplayAlert("An error has occurred", "Exception message: " + ex.Message, "Dismiss");
}
else
{
}
}
catch (Exception ex)
{
string test = ex.Message;
throw ex;
}
Here is the constant file.
namespace BL
{
public class Constants
{
// Replace strings with your own values
// Azure Active Directory B2C
public static readonly string Tenant = "tenantname.onmicrosoft.com"; // Domain/resource name from AD B2C
public static readonly string ClientID = "clientid"; // Application ID from AD B2C
public static readonly string PolicySignUpSignIn = "B2C_1_SiUpIn"; // Policy name from AD B2C
public static readonly string[] Scopes = { "" }; // Leave blank unless additional scopes have been added to AD B2C
public static string AuthorityBase = $"https://login.microsoftonline.com/tfp/{Tenant}/"; // Doesn't require editing
public static string Authority = $"{AuthorityBase}{PolicySignUpSignIn}"; // Doesn't require editing
public static readonly string URLScheme = $"msal{ClientID}"; // Custom Redirect URI from AD B2C (without ://auth/)
public static readonly string RedirectUri = $"{URLScheme}://auth"; // Doesn't require editing
}
}
But I always get the below expception
10-25 08:43:57.924 I/MonoDroid( 2850): UNHANDLED EXCEPTION: 10-25 08:43:57.936 I/MonoDroid( 2850): System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: TrustFailure (A call to SSPI failed, see inner exception.) ---> System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED 10-25 08:43:57.936 I/MonoDroid( 2850): at /Users/builder/jenkins/workspace/xamarin-android-d15-8/xamarin-android/external/mono/external/boringssl/ssl/handshake_client.c:1132 10-25 08:43:57.936 I/MonoDroid( 2850): at Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00038] in :0 10-25 08:43:57.936 I/MonoDroid( 2850): at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status) [0x0003e] in :0 An unhandled exception occured.
I've created a new organization on CRM 2015 and everything went dandy. Then, I attempted to create an additional one on the server and got the error listed below.
What on Earth are "neglected cases" in a new organization?
16:10:44| Error| System.Exception: Publishing CRM reports failed. ---> Microsoft.Crm.CrmException: Could not publish report 'Neglected Cases' due to the following error: An error occurred while trying to add the report to Microsoft Dynamics CRM. Try adding the report again. If this problem persists, contact your system administrator. ---> Microsoft.Crm.CrmReportingException: An error occurred while trying to add the report to Microsoft Dynamics CRM. Try adding the report again. If this problem persists, contact your system administrator. ---> System.Web.Services.Protocols.SoapException: Error while loading code module: ‘Microsoft.Crm.Reporting.RdlHelper, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’. Details: Could not load file or assembly 'Microsoft.Crm.Reporting.RdlHelper, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Microsoft.Crm.ReportingServices2005.ReportingService2005.CreateReport(String Report, String Parent, Boolean Overwrite, Byte[] Definition, Property[] Properties)
at Microsoft.Crm.Reporting.RuntimeReportServer.UploadReport(String path, Byte[] reportDefinition, String name, String description, Boolean overwriteExistingReport)
--- End of inner exception stack trace ---
at Microsoft.Crm.Reporting.RuntimeReportServer.UploadReport(String path, Byte[] reportDefinition, String name, String description, Boolean overwriteExistingReport)
at Microsoft.Crm.Reporting.RuntimeReportServer.UploadReport(SRSReport report, String reportNameOnSrs, String name, String description, Boolean isSharedReport, Boolean overwriteExistingReport)
at Microsoft.Crm.ObjectModel.ReportServiceInternal1.UploadSRSReport(Guid reportId, String reportNameOnSrs, String name, String description, SRSReport srsReport, ExecutionContext context, Boolean isCustomReport, Boolean overwriteExistingReport)
at Microsoft.Crm.ObjectModel.ReportServiceInternal1.CreateInternal(IBusinessEntity entity, Boolean isScheduledReport, ExecutionContext context)
at Microsoft.Crm.Reporting.ReportPublisher.UploadReportInternal(IBusinessEntity report, Int32[] relatedEntitiesArray, Int32[] categoriesArray, Int32[] visibilitiesArray, Guid organizationId, Boolean isProvisioning)
at Microsoft.Crm.Reporting.ReportSetupPublisher.UploadReportInternal(IBusinessEntity report, Int32[] relatedEntitiesArray, Int32[] categoriesArray, Int32[] visibilitiesArray, Guid organizationId, Boolean isProvisioning)
at Microsoft.Crm.Reporting.ReportPublisher.UploadReport(String reportFolder, String reportName, String fileName, String description, Int32 languageCode, Int32[] categoriesArray, Int32[] relatedEntitiesArray, Int32[] visibilitiesArray, Object parentId, Guid signatureId, Version version, Guid organizationId, Hashtable reportsPublished, String reportNameOnSrs, Boolean isProvisioning)
at Microsoft.Crm.Reporting.ReportPublisher.UploadReports(Guid organizationId, String reportFolder, Int32 languageCode, Int32 matchCategoryNumber, Int32 addCategoryNumber, IProgressEventSource progress, Boolean isProvisioning)
--- End of inner exception stack trace ---
at Microsoft.Crm.Reporting.ReportSetupPublisher.OnPublishFail(Exception exception, String message)
at Microsoft.Crm.Reporting.ReportPublisher.UploadReports(Guid organizationId, String reportFolder, Int32 languageCode, Int32 matchCategoryNumber, Int32 addCategoryNumber, IProgressEventSource progress, Boolean isProvisioning)
at Microsoft.Crm.Setup.Server.Utility.ReportsUtility.UploadReports(String orgUniqueName, String reportFolder, Int32 languageCode, Int32 matchCategoryNumber, Int32 addCategoryNumber, IProgressEventSource progress)
at Microsoft.Crm.Tools.Admin.RSPublishAction.PublishReports(String organizationUniqueName)
at Microsoft.Crm.Tools.Admin.RSPublishAction.Do()
at Microsoft.Crm.Setup.Shared.CrmAction.ExecuteAction(CrmAction action, IDictionary parameters, Boolean undo)
--- End of inner exception stack trace ---, Error, AbortRetryIgnore, Option1
16:10:51| Info| InputResult: Ignore
16:10:51| Info| CrmAction execution time; RSPublishAction; 00:00:34.6283317
16:10:51| Error| Installer Complete: OrganizationCreator - Error encountered
16:10:51| Info| Setting organization state. New state = Enabled
16:10:51| Info| Found the older table DBUpdateInstallInfo_V5, updating new table and deleting
16:10:51| Info| GetDBUpdateRevisionThresholdForServer(): Threshold = 7.0.0000.3543.
Neglected Cases is the name of a standard report that is published when you are creating a new organization (this report shows cases that have not been processed within a given time).
When you create a new CRM organization, the standard reports are published. The interesting detail about your error is this line:
Could not load file or assembly 'Microsoft.Crm.Reporting.RdlHelper'
It seems to me your installation is corrupt. Did you install the "Microsoft Dynamics CRM Reporting Extensions" on the SQL/Reporting server?
I want to send an observablecollection object through a WCF service and receive it in windows phone 8 app.
the service Is as below.
public ObservableCollection<State> GetName()
{
StateEntities objEntities = new StateEntities();
ObservableCollection<State> stateCollection = new ObservableCollection<State>();
foreach (State s in objEntities.States)
{
stateCollection.Add(s);
}
return stateCollection;
}
State is a Class having data from the table. The contract is given below
public interface IHost
{
[OperationContract]
string DoWork();
[OperationContract]
ObservableCollection<State> GetName();
}
Now I want to consume the service in a windows phone app.
A button click should trigger the service consumption , get data from the service as observable collection and feed it into a gridview.
public sealed partial class MainPage : Page
{
ServiceReference1.HostClient proxy;
public MainPage()
{
proxy = new HostClient();
this.InitializeComponent();
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
ObservableCollection<State> stateCollection = new ObservableCollection<State>();
stateCollection = await proxy.GetNameAsync();
dataGrid.ItemsSource = stateCollection;
}
}
but it is throwing and exception in the await line.
This is the exception.
An exception of type 'System.ServiceModel.CommunicationException'
occurred in mscorlib.dll but was not handled in user code
Additional information: An error occurred while receiving the HTTP
response to "ttp://localhost:65338/Host.svc." This could be due to the
service endpoint binding not using the HTTP protocol. This could also
be due to an HTTP request context being aborted by the server
Can anybody suggest an alternative or solution ?
I am trying to set up a MassTransit request/response scenario. The issue is that the message never arrives at the consumer. I get a “timeout waiting for response” error on PublishRequest. No other errors are showing up in the log file. Messages are being created in msmq.
Exception information:
Exception type: TargetInvocationException
Exception message: Exception has been thrown by the target of an invocation. at System.RuntimeTypeHandle.CreateInstance(RuntimeType
type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached,
RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean
skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly,
Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic) at
System.Activator.CreateInstance(Type type) at
System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext
requestContext, Type controllerType)
Timeout waiting for response, RequestId:
08cfa243-4a88-ba3a-20cf-307f54910000 at
MassTransit.RequestResponse.RequestImpl1.Wait() in
d:\BuildAgent-03\work\8d1373c869590c5b\src\MassTransit\RequestResponse\RequestImpl.cs:line
124 at
MassTransit.RequestResponseExtensions.PublishRequest[TRequest](IServiceBus
bus, TRequest message, Action1 configureCallback) in
d:\BuildAgent-03\work\8d1373c869590c5b\src\MassTransit\RequestResponseExtensions.cs:line
31 at Producer.Website.Controllers.AccountController..ctor() in
c:\Users\rick\Documents\Visual Studio
2012\Projects\ConsumerTest1\Producer.Website\Controllers\AccountController.cs:line
56
Producer setup:
_bus = ServiceBusFactory.New(sbc =>
{
sbc.UseMsmq();
sbc.VerifyMsmqConfiguration();
sbc.UseMulticastSubscriptionClient();
sbc.SetNetwork("Test");
sbc.ReceiveFrom("msmq://localhost/consumer_test_1");
});
Producer send message:
var message = new AccountNewMessage()
{
CorrelationId = CombGuid.Generate(),
UserName = “blah blah”,
Password = “yada yada”
};
this._bus.PublishRequest(message, r =>
{
r.SetTimeout(30.Seconds());
r.Handle<AccountNewMessageResponse>(m =>
{
var response = m;
});
});
Consumer setup:
this.bus = ServiceBusFactory.New(sbc =>
{
sbc.UseMsmq();
sbc.VerifyMsmqConfiguration();
sbc.UseMulticastSubscriptionClient();
sbc.SetNetwork("Test");
sbc.ReceiveFrom("msmq://localhost/consumer_test_2");
sbc.Subscribe(subs => subs.Instance(new AccountNewMessageConsumer()));
});
Consumer:
public class AccountNewMessageConsumer : Consumes<AccountNewMessage>.Context
{
public void Consume(IConsumeContext<AccountNewMessage> context)
{
context.Respond(new AccountNewMessageResponse()
{
CorrelationId = context.Message.CorrelationId,
ErrorCode = "1",
UserId = new Random().Next(1, 10000).ToString()
});
}
}
Messages:
[Serializable]
public class AccountNewMessage : CorrelatedBy<Guid>
{
public Guid CorrelationId { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
}
[Serializable]
public class AccountNewMessageResponse : CorrelatedBy<Guid>
{
public Guid CorrelationId { get; set; }
public string UserId { get; set; }
public string ErrorCode { get; set; }
}
What am I doing wrong? Thank you.
You will have to tell MassTransit how to store it's subscription info (for MSMQ).
There are two choices: MSMQ Multicast, which keeps subscription information in memory, and MSMQ Runtime Services which stores the subscription information in a database, so it persists between sessions.
Your choice of which to use will depend on whether you require permanent or temporary subscriptions - from the docs:
Permanent subscriptions represent a subscription that you want to have
stay around even if your process is shut down (maybe you are doing an
upgrade and don’t want to miss a message). A temporary subscription is
to be used in the case where you won’t care if you miss a message
while shut down.
There's no reason you couldn't use Multicast during development / PoC and switch to RuntimeServices later. The docs page also shows how to set up each in configuration, of course with RuntimeServices you also have to set up a database.
(Note that Multicast can take a little while to set itself up, so you might need to give your test system a pause to warm up before you start pumping messages through it.)
Edit: I've appended a couple of routines which validate the subscriptions and consumers: you would call the first while setting up subscriptions (ie during sbc.Subscribe) and the second once the bus is configured. Perhaps they will help find the problem?
private void ValidateSubscriptions(Configurator configurator)
{
var errors = configurator.Validate();
Console.WriteLine("Subscription Validation");
Console.WriteLine("-----------------------");
foreach (var err in errors.Where(e => string.IsNullOrEmpty(e.Value) == false))
{
Console.WriteLine("Type: {0} Message: {1} Key: {2} Value: {3}",
err.Disposition, err.Message, err.Key, err.Value);
}
}
private static void ValidateBus(Configurator bus)
{
var errors = bus.Validate();
Console.WriteLine("Consumer Validation");
Console.WriteLine("-------------------");
foreach (var err in errors.Where(e => string.IsNullOrEmpty(e.Value) == false))
{
Console.WriteLine("Type: {0} Message: {1} Key: {2} Value: {3}",
err.Disposition, err.Message, err.Key, err.Value);
}
}
I am attempting my first Visual Studio 2010 plugin and am attempting to reference the ActiveSolutionProjects like so
private DTE2 _applicationObject;
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
...
}
private void load()
{
var theProjects = (System.Array)_applicationObject.ActiveSolutionProjects;
...
}
The
var theProjects = (System.Array)_applicationObject.ActiveSolutionProjects;
line fails with
Error HRESULT E_FAIL has been returned from a call to a COM component.
ErrorCode -2147467259
Any idea how I fix this error?
The issue is there is no active solution selected and a null reference issue. I just wrapped the call in an exception handler and am investigating how to set the active solution through automation.