Call Custom Service outside the CRM hosted website
How
to call the Custom Rest/Webservice outside the CRM website in OnPremsies in
CRM:
Purpose:
Why we need to host the custom service inside the CRM rather than outside?
Reason behind this is if we host the custom service inside the CRM,if any crashes happen in the custom service it will affect the CRM application because of same application pool.If we host outside the CRM website this wont happen.
Purpose:
Why we need to host the custom service inside the CRM rather than outside?
Reason behind this is if we host the custom service inside the CRM,if any crashes happen in the custom service it will affect the CRM application because of same application pool.If we host outside the CRM website this wont happen.
1.Create
a REST service in Visual studio2013 using Web API
2.
The following links helps you to enable CORS using nuget package console
3.Once
u enable the CORS using above link,Publish the application and make
sure all dll allow local copy set to true in the properties.
4.Host
the the custom service in separate website in IIS(ouside the CRM with
Https enabled)
5.When
ran the custom service through IIS to make sure it is working or not
the
following errror occured.
Error:
Attempt
by security transparent method
'System.Web.Http.GlobalConfiguration.get_Configuration()' to access
security critical type 'System.Web.Http.HttpConfiguration' failed
6.
The below steps would solve the problem.
Steps
to Do:
- Go to Tools->Nuget Package Manager->Package manager Console
- Run the below command in order
Update-Package
Microsoft.AspNet.WebApi -Pre
Install-Package
Microsoft.AspNet.WebApi.OData -Version 5.0.0
Publish
the changes and host again will solve the issue
Ref:
http://stackoverflow.com/questions/18476370/how-do-i-resolve-the-error-attempt-by-security-
transparent-method-system-web-h
Today
we learnt how to Call the Custom services outside the CRM website in
OnPremsies in CRM
Comments
Post a Comment