microsoft Dynamics's discovery.svc - c#

I want to connect to microsoft dynamics CRM via tools or code, but every time I try I get this error :
the provided uri did not return any service endpoints
Also when I go to its discovery.svc link I get the following error :
An error has occurred.
Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organization's Microsoft Dynamics CRM Administrator. Finally, you can contact Microsoft Support.
I check the IIS binding and its just bind to 5555 for HTTP and 5556 for HTTPS and also the above error occur on server side too, I mean when I go to http://myAddress:5555/XRMServices/2011/Discovery.svc both in server and clients I get the error. I cant find any thing that could solve my problem in the internet and I'm stock in this simple problem for several days.

I think after I solved my problem this could be useful for somebody. There was two problem first my server has configuration problem and server needs restart to free its memory. so it's not bad if you check how memory you are using, and if its possible restart the server.
and after that I have a proxy problem that could be fix with creating a file name app.config and writing this lines:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<defaultProxy >
</defaultProxy>
</system.net>
</configuration>
Then it'll works fine

Related

Fiddler doesn't capture traffic with "GetAsync"

I'm trying to debug a call to my ServiceStack web service from a .net 472 application. Fiddler has always been the obvious choice for inspecting traffic in my other applications targeting the same service.
Strangely, I cannot get Fiddler to capture any traffic when using the GetAsync() method of the JsonServiceClient. The call returns data as expected without issue, just not tracked in Fiddler:
var response = await client.GetAsync(new AroCodesRequest());
However, if I use the Get() method, Fiddler captures the traffic as expected:
var response = client.Get(new AroCodesRequest());
(Edit) Adding the following to App.config doesn't help:
<system.net>
<defaultProxy>
<proxy proxyaddress="http://127.0.0.1:8888" bypassonlocal="False" />
</defaultProxy>
</system.net>
I've put Fiddler into troubleshooting mode, still no luck. I've been unable to find much helpful information on Google/SO, I suspect I may simply not be asking the correct question.
Update
Downgrading from ServiceStack 5.6.0 to 5.5.0 has caused Fiddler to capture the traffic again. I'm guessing it has something to do with this line in the 5.6.0 release notes - https://docs.servicestack.net/releases/v5.6#service-clients-async-webproxy - I don't fully understand whats going on, I'll keep looking at it.
In v5.6 the AsyncServiceClient uses the Proxy configured on the ServiceClient, previously it didn't. But it used the Proxy even if one wasn't configured which looks like causes this issue where setting it to null seems to unset the Proxy configuration in your Web.config.
I've changed it to only use the proxy if one was configured in this commit.
This change is available from v5.6.1 that's now available on MyGet.

ADFS 2.0 Microsoft.IdentityServer.Web.InvalidRequestException: MSIS7042

I have a custom MVC site that uses ADFS authentication for users to access the site.
This was working, I have since made no changes, with the only change occurring on the ADFS side with the TOKEN certificates rolling over. Unfortunately I cannot seem to find anything that indicates that this is related to my now very frustrating error.
Simply put no user can log in, thank goodness this is still under development so at least I do not have screaming users on my hands. I have a Dynamics CRM 2011 environment IFD and Claims-Based auth using this same ADFS server. I have also removed and recreated the Relying-Party Trusts, but still with no luck.
All I get is the following error on the page with the accompanying Event Log entry:
Site:
There was a problem accessing the site. Try to browse to the site again.
Event Log:
Encountered error during federation passive request.
Additional Data
Exception details:
Microsoft.IdentityServer.Web.InvalidRequestException: MSIS7042: The same client browser session has made '6' requests in the last '6' seconds. Contact your administrator for details.
at Microsoft.IdentityServer.Web.FederationPassiveAuthentication.UpdateLoopDetectionCookie()
at Microsoft.IdentityServer.Web.FederationPassiveAuthentication.SendSignInResponse(MSISSignInResponse response)
I have searched high and low, I have tried every suggestion I can find, including this post: ADFS v2.0 Error : MSIS7042: The same client browser session has made '6' requests in the last '1' seconds
I have configured my relying party trusts as per the following URL: http://www.cloudidentity.com/blog/2014/02/12/use-the-on-premises-organizational-authentication-option-adfs-with-asp-net-in-visual-studio-2013
I forgot to turn off custom errors, so now I get the following:
WIF10201: No valid key mapping found for securityToken: 'System.IdentityModel.Tokens.X509SecurityToken' and issuer: 'http://XXX.XXX.XXX/adfs/services/trust'.
As such I have corrected the Certificate Thumbprint, but unfortunately that doesn't seems to help the situation.
Still searching and trying solutions for this issue and will update if anything changes.
Any assistance in this regard would be greatly appreciated.
Thanks
Fixed it !! :):)
It seems there was an issue with the "issuerNameRegistry" entry in my Web.Config.
What does confuse me as to why it was working before, but never the less, here is what fixed the issue:
I had the following in my web.config, which did work previously:
<issuerNameRegistry type="System.IdentityModel.Tokens.ValidatingIssuerNameRegistry, System.IdentityModel.Tokens.ValidatingIssuerNameRegistry">
<authority name="http://adfs.domain.tld/adfs/services/trust">
<keys>
<add thumbprint="thumbprint"/>
</keys>
<validIssuers>
<add name="http://adfs.domain.tld/adfs/services/trust"/>
</validIssuers>
</authority>
</issuerNameRegistry>
Thanks to this answer https://stackoverflow.com/a/21289207/2985339 on this post Windows Azure intermittent Identity error when parsing webconfig
This is what the web.config now has:
<issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<trustedIssuers>
<add thumbprint="thumbprint" name="http://adfs.domain.tld/adfs/services/trust" />
</trustedIssuers>
</issuerNameRegistry>
Beats me as to why it stopped working, but if anyone else has this issue, hopefully this will help. :)
For the 7402 error, ensure that the identifier in your web.config and the endpoint in the RP both have a trailing slash and that they both match.
For the non-valid key, use the MMC plugin on the server side to get the thumbprint and then post this into something like Notepad++ and inspect it - ensure no dodgy characters etc., then remove spaces and then paste it into the web.config.
I've seen this a number of times.
Sorry to necro up an old thread but to those that up-voted the correct answer - did you add any new references to your project? Import anything etc?
Obviously ValidatingIssuerNameRegistry is not ConfigurationBasedIssuerNameRegistry so was wondering what steps were taken to add/remove any assemblies / versions etc.

MS Dynamics CRM online 2011 - Authentication issues

I am a total newbie with dynamics crm online (2011), and although I have been working through the SDK sample code, I am trying to find the simplest way to perform a basic authenticated connection to our online Dynamics CRM service, and push some very basic data to a custom entity/extension I have created.
Hopefully you can see from the above code snippet (sensitive data blurred), I am probably trying to circumvent the authentication process? The above code example was based a little on some of the code samples in the CRM SDK, and also from a code project example. I don't know if the code above would even work? actually it seems to try, and only when the "serviceProxy.Create" is executed do I get an authentication error.
I have also managed to navigate out of the corporate firewall with the following addition to my app.config file:
<system.net>
<defaultProxy useDefaultCredentials=”true”>
<proxy usesystemdefault="true"/>
</defaultProxy>
</system.net>
Again, not sure if there is a very basic way to connect? or should I really fall back to the SDK helper files?
This is the simplest way to connect to CRM Online, you need only to add reference to Microsoft.Xrm.Sdk.Client and Microsoft.Xrm.Client.Services
CrmConnection crmConnection = CrmConnection.Parse("Url=https://XXX.crm.dynamics.com; Username=user#domain.onmicrosoft.com; Password=passwordhere;");
OrganizationService service = new OrganizationService(crmConnection);
Entity account = new Entity("account");
account ["name"] = "Test Account";
Guid accountId = service.Create(account);
Refers to this msdn article for create the right connection string
Simplified Connection to Microsoft Dynamics CRM

Calling WebService In Cross Domain

I want to call webservice from domain A with the C# code in Domain B. I have tried to add web reference with URL of that web service but it gives error like
There was an error downloading 'http://localhost:15666/MailBox/'.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it 127.0.0.1:15666
There was an error downloading 'http://localhost:15666/MailBox/$metadata'.
Unable to connect to the
I am having so many issues because of cross domains. Is there any solution for this?
Since you have requested the web service on localhost, this isn't a cross-domain issue. I suspect that you need to update your reference to point to a web service on a different machine.
Your problem (at least the exception you pasted) has nothing to do with calling web services on another domain. It indicates that your machine (localhost) has port 15666 closed and hence you receive the actively refused it error message. You are either not running your web service on that port or your windows firewall is blocking the connection, although this is very unlikely since firewalls usually accept connections from localhost.
You can always check this sort of thing by telneting to localhost on the particular port you are interested in or by using nmap to scan your own ports.
Hi finally I get answer for my question ,This is not problem with crossdomain but I get problems because I didn't create disco file or WSDL file for my webservice so I get error for metadata.I run my webservice locally get WSDL file from there and create new WSDL file for my WEB SERVICE and boom... problem solved .Thanks for all your help...
You have to create a file (clientaccesspolicy.xml) and put it into the wwwroot directory or the main directory of your webservice.
Content of the file should be like:
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
You can read more about that at To use a clientaccesspolicy.xml file to allow cross-domain access

The authentication scheme ' NTLM' is not supported and other issues migrating from .asmx to wcf

I just switched my .asmx web service to WCF (both in .NET 3.5), and now I am getting
The authentication scheme ' NTLM' is not supported.
The only thing I've seen on google is where some w3svc/NTAuthenticationProviders setting had NTML instead of NTLM. I don't have that issue.
Okay - here is a summary of some annoying WCF issues that I encountered while migrating hopefully it helps someone.
Issue 1 - "This collection already contains an address with scheme http. There can be at most one address per scheme in this collection."
This is caused, I guess, by my web server having multiple web sites with multiple host headers. Solution found here: WCF service startup error "This collection already contains an address with scheme http".
I just added a baseAddressPrefixFilter:
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://yoururl.blahblah.com/" />
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
Issue 2: I got The authentication scheme ' NTLM' is not supported. error. I struggled with that for a while but eventually a reboot made that one go away (although I also did this (http://bytes.com/topic/net/answers/705912-authentication-scheme-ntml-not-supported):
# change directory to c:\inetpub\admin scripts first
cscript adsutil.vbs set w3svc/NTAuthenticationProviders "Negotiate,NTLM"
There was a space after the first comma in my config, no idea if that was causing an issue.
Issue 3: After a reboot, I got fun .404 errors.
My first guess at this was that wcf was not set up to be hosted on my server so I ran:
(http://msdn.microsoft.com/en-us/library/ms732012.aspx)
serviceModelReg.exe -i
But the real source of the 404 was caused by me trying to go to http://yoururl/somewhere.svc instead of http://yoururl.blahblah.com/somewhere.svc (i.e. my baseAddressPrefixFilter was causing my 404).
Hope this helps!

Categories