@HASSEN-MEDDEB-ATOS commented on Thu Jan 30 2020
Hello again,
i have migrated my project from .NET Framework to .NET core. i have changed this line from
``````
sp.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
to
sp.ServiceConfiguration.CurrentServiceEndpoint.EndpointBehaviors.Add(new ProxyTypesBehavior());
because we used System.ServiceModel.Primitives
`````````
but it return Exception: Could not load type 'System.ServiceModel.Description.MetadataConversionError' from assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Thanks for all helps
Cordially
@maryamariyan commented on Thu Jan 30 2020
cc: @dotnet/dotnet-wcf
@StephenBonikowsky commented on Thu Jan 30 2020
@HASSEN-MEDDEB-ATOS The types you mentioned belong to WCF. (https://github.com/dotnet/wcf)
Not all of WCF from the full framework is available in WCF Core. We are still adding support for many features but some are not yet available and others we will not be able to support. Server side APIs will not be supported in WCF Core only Client side APIs.
System.ServiceModel.Description.MetadataConversionError is not currently supported. You can check any API in the https://apisof.net/ tool to see where it is supported.
@mconnew Is this API related to server side stuff or could it be added to the WCF Core public surface area. Looks like it was at least partially implemented in WCF Core although I don't see any references to it.
@HASSEN-MEDDEB-ATOS commented on Fri Jan 31 2020
Helle @StephenBonikowsky ,
Thanks for your answer.
I can't undestrand somthing, System.ServiceModel is deprecated in both .NET Standard and .NET Core. I have added the new package "System.ServiceModel.Primitives" i can see that System.ServiceModel has been added in the reference with version "4.7.0". the question, why i get System.ServiceModel, Version=4.0.0.0 not load ? even so i have installed the version 4.7.0
Cordially
@StephenBonikowsky commented on Fri Jan 31 2020
On full framework System.ServiceModel.dll contains most of the WCF implementation.
WCF Core works differently, all the implementation code lives in the System.Private.ServiceModel package but that package cannot be referenced directly. Instead we have 5 Façade packages in which the ref assembly has a list of publicly accessible APIs and the lib assembly type-forwards to the implementation in System.Private.ServiceModel.
Because the full framework supports netstandard2.0 as does WCF Core, we have included in our System.Primitives.ServiceModel package a Façade assembly called System.ServiceModel.dll for the scenario where you build your application on the full framework targeting netstandard2.0 and then run it on WCF Core. In that case the System.ServiceModel.dll Façade will type-forward to the WCF Core implementation in System.Private.ServiceModel.dll. It only knows about types that are supported on both full framework and core as per netstandard2.0.
So back to your error. You are trying to load a type that is not supported in WCF Core and the System.ServiceModel Façade knows nothing about it.
Since this is a WCF issue, I amgoing to move it to the WCF Repo.
Any update for this issue please ? I have tried many other solution without success
@HASSEN-MEDDEB-ATOS I'm not sure what update you are asking for, I mentioned in my previous post that you are trying to use a type that is not supported in WCF Core.
Hello,
is there any possibility to connect to dynamics without using System.ServiceModel.Description.ClientCredentials, i tried to use ADAL but i can't combined ADAL with OrganizationServiceProxy
```````
System.ServiceModel.Description.ClientCredentials cc = new ClientCredentials();
ClientCredentials cd = null;
cc.UserName.UserName = Login;
cc.UserName.Password = MDP;
// On se connecte
sp = new OrganizationServiceProxy(OrganizationUri, null, cc, cd);
sp.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
````````
Cordially
@mconnew Do you have any suggestions?
Hi again,
The OrganizationServiceProxy class implements the IOrganizationService and provides an authenticated WCF channel to the organization, in this case, can i use the higher class OrganizationService and use CrmConnection(string connectionStringName); ?
i have changed ClientCredentials with ClientCredential and implement "Microsoft.IdentityModel.Clients.ActiveDirectory" and use AzureAD authentification but i had same problem beacuse the constructor take ClientCredientials in arguement
public OrganizationServiceProxy(Uri uri, Uri homeRealmUri, ClientCredentials clientCredentials, ClientCredentials deviceCredentials);
I wait any suggestions to resolve this problem
Thank-you for your prompt response
Cordially
i did this
````````
CrmServiceClient client = new CrmServiceClient("Url=******; Username=****; Password=*****; authtype=Office365");
sp = client.OrganizationServiceProxy;
sp.ServiceConfiguration.CurrentServiceEndpoint.EndpointBehaviors.Add(new ProxyTypesBehavior());
``````````
I had another error
Could not load file or assembly 'System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Cordially
Hello again :D,
i have searched antoher solution for my issue, i have find that we can integrate SOAP web Services in .NET Core. i used WCF Web Service Reference Provider. I downloaded WSDL from my CRMDynamics365 and generated code from WSDL File. But the herror, i can't set up endpoint and user credentials beaucse this code is not found in my code :/
Normally we could have this code :/
```````
private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(TimeSpan timeout)
{
var httpsBinding = new BasicHttpsBinding();
httpsBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
httpsBinding.Security.Mode = BasicHttpsSecurityMode.Transport;
var integerMaxValue = int.MaxValue;
httpsBinding.MaxBufferSize = integerMaxValue;
httpsBinding.MaxReceivedMessageSize = integerMaxValue;
httpsBinding.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
httpsBinding.AllowCookies = true;
httpsBinding.ReceiveTimeout = timeout;
httpsBinding.SendTimeout = timeout;
httpsBinding.OpenTimeout = timeout;
httpsBinding.CloseTimeout = timeout;
return httpsBinding;
}
private static System.ServiceModel.EndpointAddress GetEndpointAddress(string endpointUrl)
{
if (!endpointUrl.StartsWith("https://"))
{
throw new UriFormatException("The endpoint URL must start with https://.");
}
return new System.ServiceModel.EndpointAddress(endpointUrl);
}
`
public MyServicePortTypeClient(string endpointUrl, TimeSpan timeout, string username, string password) :
base(MyServicePortTypeClient.GetBindingForEndpoint(timeout), MyServicePortTypeClient.GetEndpointAddress(endpointUrl))
{
this.ChannelFactory.Credentials.UserName.UserName = username;
this.ChannelFactory.Credentials.UserName.Password = password;
ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
}
public MyServicePortTypeClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
````````
I had this when i generate reference
"Endpoints is not compatible with .Net Core applications ."
"Warning: Unable to import wsdl: binding
Details: An exception was thrown in a call to a policy import extension.
Extension: System.ServiceModel.Channels.SecurityBindingElementImporter"
Cordially
@HASSEN-MEDDEB-ATOS
I downloaded WSDL from my CRMDynamics365 and generated code from WSDL File.
Would it be possible for you to provide us with your WSDL? That would help us fully understand what binding configuration you are using.
Hello @StephenBonikowsky
Thank you so much for your resposne
Can you give me your Email. i will send you the file because i can't upload .cs file type :/
Cordially
@HASSEN-MEDDEB-ATOS Please send it to *@microsoft.com
EDIT: [mconnew] I removed the email address now I've received the email to hide from spam scrapers.
Hello
i have sent the file to Matt without response, meanwhile, i have find another solution but i have same issue when the generated file, in this solution, i have managed to get it working using Unchase OData Connectedservice, but i can't find orgContext :/
Cordially
I've looked at your WSDL and it looks like you will need WSFederationHttpBinding. We should have support for that soon. I need to spend a bit more time validating that the work we're doing will be sufficient for your use case. I'll try to get to that in the next few days.
Thank you so much, is that will work in full .NET Core ? Because i need to publish all project in RedHat ?
Thank you again
Best regards.
Téléchargez Outlook pour Androidhttps://aka.ms/ghei36
From: Matt Connew notifications@github.com
Sent: Friday, February 14, 2020 12:22:45 AM
To: dotnet/wcf wcf@noreply.github.com
Cc: MEDDEB, HASSEN hassen.meddeb@atos.net; Mention mention@noreply.github.com
Subject: Re: [dotnet/wcf] Could not load type 'System.ServiceModel.Description.MetadataConversionError (#4147)
I've looked at your WSDL and it looks like you will need WSFederationHttpBinding. We should have support for that soon. I need to spend a bit more time validating that the work we're doing will be sufficient for your use case. I'll try to get to that in the next few days.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdotnet%2Fwcf%2Fissues%2F4147%3Femail_source%3Dnotifications%26email_token%3DAN3BV6UBTPWVBIQIDL77KRLRCXI4LA5CNFSM4KOKHMP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELW7RFQ%23issuecomment-586021014&data=02%7C01%7Chassen.meddeb%40atos.net%7C44668678b1e84c700ccc08d7b0dbbbc1%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C637172330099272388&sdata=9JywZOdGm%2BNuFV2hwtHLBfei9DaOhGE87By9pnIydMY%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAN3BV6TEKYPHQ3Z76BPAC6DRCXI4LANCNFSM4KOKHMPQ&data=02%7C01%7Chassen.meddeb%40atos.net%7C44668678b1e84c700ccc08d7b0dbbbc1%7C33440fc6b7c7412cbb730e70b0198d5a%7C0%7C0%7C637172330099272388&sdata=%2BlMoDDEbYcD%2FInX1XerWyhYd1Zl%2F4DvE6ZAUp2uTaBw%3D&reserved=0.
Ce message et toutes les pièces jointes (ci-après le "message") sont établis à l’intention exclusive des destinataires désignés. Il contient des informations confidentielles et pouvant être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de détruire le message. Toute utilisation de ce message non conforme à sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse de l’émetteur. L'internet ne garantissant pas l'intégrité de ce message lors de son acheminement, Atos (et ses filiales) décline(nt) toute responsabilité au titre de son contenu. Bien que ce message ait fait l’objet d’un traitement anti-virus lors de son envoi, l’émetteur ne peut garantir l’absence totale de logiciels malveillants dans son contenu et ne pourrait être tenu pour responsable des dommages engendrés par la transmission de l’un d’eux.
This message and any attachments (the "message") are intended solely for the addressee(s). It contains confidential information, that may be privileged. If you receive this message in error, please notify the sender immediately and delete the message. Any use of the message in violation of its purpose, any dissemination or disclosure, either wholly or partially is strictly prohibited, unless it has been explicitly authorized by the sender. As its integrity cannot be secured on the internet, Atos and its subsidiaries decline any liability for the content of this message. Although the sender endeavors to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.
It will be cross platform on .NET Core so will work on all Linux distro's that .NET Core is supported on. We're waiting on a deliverable from another team before we can move forward and there's been a few delays so I can't comment on an expected release date at this point. I can tell you it won't be by Feb 19th though as there's still a few weeks worth of work to get done after the other team provides their piece. I also need to validate that the specific WS-* protocol versions you are using will be supported.
I'm in the same situation as Hassen-Meddeb-Atos, i'm trying to connect to Dynamics CRM through .Core, and am facing the same issues. so i'm curious to see the WSFederationHttpBinding implementation.
Will keep a close eye on this thread :)
Regards
Hello,
@mconnew is there any news please
Cordially
Hello Everyone,
I came across an article talk about .NET Core CDS SDK Alpha Availability, it's incredible, i have finally succeed to connect to Dynamics CRM using Microsoft.Powerplatform.Cds.Client;
````````
var s1 = @"AuthType=Office365;
Url=*;
UserName=@.onmicrosoft.com;
Password=**";
var conn = new CdsServiceClient(s1);
````````
but i can't find OrganizationServiceProxy because it has deperceated ;'(
Any suggestion please, need to make it work so urgent
Thank you for the work you have done
Cordailly
@HASSEN-MEDDEB-ATOS The work on WSFederationHttpBinding is progressing. I understand you have a pressing schedule, other businesses are also blocked on having WSFederationHttpBinding available and it is being actively worked on.
I understand you are looking into other solutions, unfortunately we don't have expertise on Dynamics 365 APIs.
Have you tried reaching out on the Dynamic 365 site? I found a quite a few posts regarding .NET Core.
@StephenBonikowsky @mconnew
Hello,
microsoft announced the availability of CdsServiceClient on .NET Core, I tried a lot of authentication type and the result is the same,
````````
string connectionstring = ConfigurationManager.ConnectionStrings["connectionVSMPSecretkey"].ConnectionString;
sp = new CdsServiceClient(connectionstring);
`````````
i used client secret authentification
`````
AuthType=ClientSecret;
url=https://contosotest.crm.dynamics.com;
ClientId={AppId};
ClientSecret={ClientSecret}
/>
````````````
but i get error System.ServiceModel.Security.MessageSecurityException: The HTTP request was forbidden with client authentication scheme 'Anonymous'.
I have invesitgated in this issue and maybe it's related with wsHttpBinding :'(
the only thing that bothers me, when i tested my authentification with postman using clientcredntial it work fine
I apperciate any suggesstion from you
Cordially
Hello again,
How can i implement CustomBinding like this in my code
var binding = new CustomBinding
{
Elements = { new HttpTransportBindingElement //or HttpTransportBindingElement for https:
{
MaxBufferSize = int.MaxValue,
MaxReceivedMessageSize = int.MaxValue,
AuthenticationScheme = AuthenticationSchemes.Anonymous
}}
};
Cordially
Could you please search the repo under https://github.com/dotnet/wcf/tree/master/src/System.Private.ServiceModel/tests
For "CustomBinding" or anything else you are interested in and see what is there first.
Hello,
The test to connect to dynamics crm was carried out successfully using CDS SDK in .NET Core using connection string with client secret authentification, the solution is not very reliable because CDS SDK hasn't any stable version
Cordially
I am not sure if this helps but there is a nuget package now Microsoft.PowerPlatform.Dataverse.Client that can help to connect to Dynamics 365.
Most helpful comment
I'm in the same situation as Hassen-Meddeb-Atos, i'm trying to connect to Dynamics CRM through .Core, and am facing the same issues. so i'm curious to see the WSFederationHttpBinding implementation.
Will keep a close eye on this thread :)
Regards