SmtpResponse exception in constructor - exchange-server

I'm updating our spamfilter from Exchange 2013 to 2019. My transport agent references these two DLLs:
Microsoft.Exchange.Data.Common.dll
Microsoft.Exchange.Data.Transport.dll
Both of the following lines of code generate an exception, when I replace the 2013 versions of these DLLs with the new ones from Exchange 2019:
// Exchange 2019 syntax
SmtpResponse smtpResponse = SmtpResponse.Create("550", "5.7.1", "A single string");
// Exchange 2013 syntax (deprecated under 2019, but still compiles)
SmtpResponse smtpResponse = new SmtpResponse("550", "5.7.1", "A single string");
The exception message is:
Der Typeninitialisierer für
"Microsoft.Exchange.Data.Transport.Smtp.SmtpResponse" hat eine
Ausnahme verursacht."* The type initializer for … has generated an
exception.
Even this simple line leads to an Exception:
SmtpResponse smtpResponse = new SmtpResponse();
Any ideas why the constructor of SmtpResponse throws this exception? On Exchange 2013, this code has been running flawlessly for years.

OK, on Exchange Server 2019, Microsoft.Exchange.Data.Transport.dll has a new dependency, Microsoft.Exchange.Diagnostics.dll. This DLL is NOT in the Public folder of your Exchange Server as the other DLLs, but in the bin folder.
Copying Microsoft.Exchange.Diagnostics.dll to my local bin folder solved the problem.

Related

Unable to connect to Dynamics CE v.9.0 on-Premises

I have a problem with connecting my .net 4.6.2 console app to our on-Premises Dynamics CE v.9.0 installation.
I have the following code to connect:
CrmServiceClient conn = new CrmServiceClient(connectionString);
OrganizationServiceProxy = conn.OrganizationServiceProxy;
This is my connectionString
<add name="CRM" connectionString="Url=http://ServerFQDN/OrgUniqueName; Domain=Mydomain; Username=MyUser; Password=MyPW; AuthType=AD;"/>
I followed the instructions on the following page to generate the ConnectionString
https://learn.microsoft.com/en-us/dynamics365/customer-engagement/developer/xrm-tooling/use-connection-strings-xrm-tooling-connect
Unfortunately is the OrganizationServiceProxy null all the time.
When i look in my CRMServiceClient i do get the following in LastCrmError
LastCrmError = "Unable to Login to Dynamics CRMOrganizationWebProxyClient is nullOrganizationWebProxyClient is null"
I updated all my NuGet packages to the newest Version:
Microsoft.CrmSdk.CoreAssemblies is 9.0.2.5
Microsoft.CrmSdk.Deployment is 9.0.2.5
Microsoft.CrmSdk.Extensions is 7.1.0.1
Microsoft.CrmSdk.Workflow is 9.0.2.5
Microsoft.CrmSdk.XrmTooling.CoreAssembly is 9.0.2.7
Had anyone had the same Problem?
Do you have a tip for me what could be the Problem?
EDIT
I just noticed, that i am not able to Login via the .NET application but also PluginRegistration and XRMToolBox is not working.
I do assume there is an error with the authentication. Maybe in AD.
When i try to connect i now always get the two following errors:
Microsoft.Xrm.Tooling.Connector.CrmServiceClient
Source : mscorlib
Method : HandleReturnMessage
Error : The caller was not authenticated by the service.
And
Inner Exception Level 1:
Source : System.ServiceModel
Method : ThrowIfNegotiationFault
Error : The request for security token could not be satisfied because authentication failed.
EDIT2
If i login to the Deployment Manager i can see "Failed" in the Status field. I think this is related to each other.
Try to add this line before creating CrmServiceClient object
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
I was able to fix the issue.
The Problem was, that there was some mismatch in between our DB an the Deployment Manager.
The following Steps fixed our Problem:
Delete the Organization in Deployment Manager
Import the Organization again from an existing Organization in Deployment Manager
Configure HTTPS (i think this was not necessary to fix the problem)
Hope this helps others.
PS: Here is a link that describes how you can configure HTTPS:
https://learn.microsoft.com/en-us/dynamics365/customer-engagement/on-premises/post-installation-configuration-guidelines-dynamics-365

Errors when running Apps in ASP.NET MVC CORE

I am recently set up Visual Studio 2017, but
When i try to start ASP.NET MVC CORE Project that runtime error appears:
System.MissingMethodException occurred
HResult=0x80131513
Message=Method not found: 'System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)'.
Source=
StackTrace:
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at WebApplication4.Program.Main(String[] args) in C:\Users\qqq\documents\visual studio 2017\Projects\WebApplication4\WebApplication4\Program.cs:line 14
and when i try to run another ASP.NET MVC CORE Project this error message appears:
Unable to start process C:\Program Files\dotnet\dotnet.exe. The web server request failed with status code 500, Internal Server Error. The full response has been written to C:\Users\qqq\AppData\Local\Temp\HttpFailure_04-02-08.html.
Are these errors because of IIS Error or something in configuration ?

Classic ASP error '800a01b6' Object doesn't support this property or method

I have an error that I cannot resolve, the server is showing this
Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method: 'SharedSession'
/includes/minicart.asp, line 183
In minicart.asp we have the following code:
(180)dim SharedSession
(181)set SharedSession = Server.CreateObject("SessionMgr.Session2")
(183)dim miniCartXML: miniCartXML = "" & SharedSession("minicart")
For some reason when the client clears their browsing history the error goes away but it will eventually come back again.... ??
The server is Windows 2008 r2 64bit. The app is running in IIS7 with 32bit enabled.

Connect to mscrmservices/2007/CrmService.asmx endpoint in CRM 2011 IFD/ADFS

We have just upgraded from Microsoft Dynamics CRM 4 to Microsoft Dynamics CRM 2011. Most of the upgrade has gone smoothly, however I have some custom code (written for CRM 4) which was implemented as an ASPX page in the CRM 4 ISV folder. This code has stopped working since the upgrade.
Our Dynamics CRM 2011 server is set up On Premise, as an IFD deployment.
The code connects to the CRM Server as follows:
using (new CrmImpersonator())
{
string crmurl = "https://<server>:444/<org>/mscrmservices/2007/CrmService.asmx";
string orgname = <org>;
CrmAuthenticationToken token = CrmAuthenticationToken.ExtractCrmAuthenticationToken(context, orgname);
token.OrganizationName = orgname;
token.AuthenticationType = 0;
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.CrmAuthenticationTokenValue = token;
service.Url = crmurl;
WhoAmIRequest who = new WhoAmIRequest();
WhoAmIResponse whoResponse = (WhoAmIResponse)service.Execute(who);
Upon sending the WhoAmIRequest I receive the following exception:
The request failed with the error message:
--
<html><head><title>Object moved</title></head><body>
<h2>Object moved to here.</h2>
</body></html>
--.
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.SdkTypeProxy.CrmService.Execute(Request Request)
at ForecastConverterWeb.CashflowForecast.ToCrm(HttpContext context)
at ForecastConverterWeb._Default.submitbtn_click(Object sender, EventArgs e)
It seems that when the code tries to send the request to https://:444//mscrmservices/2007/CrmService.asmx the page returns a link to redirect to, well... itself (https://:444//mscrmservices/2007/CrmService.asmx).
I've tried using the internal address (port 5555), external IFD address (https over port 444) and internal IFD (https over port 444) address all with the same result. I know that in CRM 2011 ISV is being depreciated, but the considering the amount of time it would take to re-develop this software (and the fact that considering it's supported code, I shouldn't have to) I'd rather just get this working as it should (according to this: http://msdn.microsoft.com/en-us/library/gg309571.aspx)
I'm grateful in advance for any help anyone can offer.
Your code makes it look like you put the organization name between the host and the path to the /2007/crmservice.asmx. Don't do that. I know you have to prepend the organization name when on-premise to custom aspx/asmx files in the ISV directory, but as far as I've ever tried it doesn't work for crmservice.asmx.

Sharepoint 2010 Client Object Model Remote Access via HTTPS

I was encouraged to learn that the Sharepoint 2010 Client Object Model essentially wraps remote calls to the server. So, I copied the Microsoft.Sharepoint.Client.Silverlight.dll and Microsoft.Sharepoint.Client.Silverlight.Runtime.dll from my Sharepoint 2010 server to my development machine (without Sharepoint). I assumed the Silverlight code I tested on the Sharepoint 2010 server would also work on my development machine. Naturally, I don't use the "ApplicationContext.Current.Url" because I am not executing in Sharepoint, so I manually add sharepoint server name as follows (kept anonymous for the post):
//ClientContext context = new ClientContext(ApplicationContext.Current.Url);
ClientContext context = new ClientContext("https://[servername]");
_web = context.Web;
context.Load(_web);
context.Load(_web.Lists);
context.ExecuteQueryAsync(new ClientRequestSucceededEventHandler (OnRequestSucceeded), new ClientRequestFailedEventHandler(OnRequestFailed));
When I execute the code, I am prompted by a Windows Authentication window (Sharepoint is configured to use Windows Authentication), I add my domain/user and password. However, I am getting the following error:
Note: I was able to get Sharepoint 2010 web services working given a similar error by changing the binding security mode="Transport" and including a clientAccessPolicy.xml file on the Sharepoint root website. Do I need to configure another Sharepoint directory for thje Client Object Model endpoint?
Exception {System.Security.SecurityException ---> System.Security.SecurityException: Security error.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.b__0(Object sendState)
--- End of inner exception stack trace ---
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryGetResponseAsyncCallback(IAsyncResult asyncResult)} System.Exception {System.Security.SecurityException}
Please look in to the below blog post, you need to add clientaccesspolicy.xml file in your sharepoint website root folder.
http://vangalvenkat.blogspot.com/2011/08/sharepoint-2010-getting-list-item.html
Aha, I found it. You can set the security on the client context to use the default windows authentication like so:
using (Microsoft.Sharepoint.Client.ClientContext ctx = new Microsoft.Sharepoint.Client.ClientContext("http://sharepointserver")){
ctx.AuthenticationMode = Microsoft.Sharepoint.Client.ClientAuthenticationMode.Default
}
This should also prevent any windows authentication pop-ups

Resources