JSONP is always a popular way to use the open policy of SCRIPT HTML element to implement the cross-domain access by a lot of developers. However, most of their knowledge blogs are just the segments of one of the integrated solutions. In this article, we will introduce a whole integrated solution to implement the cross-domain access to WCF Service in SharePoint Site Collection by HTTPS protocol. We have introduced the WCF service configuration. And the WCF application was ready. In this paragraph, we will start to deploy our across domain web service application on IIS.
After finishing coding, we can deploy the service on one IIS server. There’s something we need pay attention to when we deploy the WCF service for cross-domain access. There is a little difference between the Website deployment and Website application deployment.
A. Website Creation
a) New Website and choose HTTPS schema and credential.
Figure 4-1: Website creation dialog.
b) Test Settings by clicking the ‘Test Settings’ button in the above dialog.
If you find the authorization error like the diagram 4-2 shows, you need to edit the application workspace folder permission as the diagram 4-3 shows.
Figure 4-2: Authorization Error
Figure 4-3: Folder Permission Settings.
c) Set Authentication
At final, we need to update the authentication for Website as the Authentication & Credential section mentioned. For windows authentication, we should only enable windows authentication in the IIS Website authentication setting center as diagram 4-4 shows.
Figure 4-4: IIS Web Site Authentication.
B. Web Site Application Creation
The website application creation has a little difference from the website creation.
a) Check the hosted website binding settings.
The hosted website should be bound to HTTPS schema. If not, you should edit the binding to support HTTPS. You can right click the website and click ‘Edit Binding’ button in the context menu. Then you will see the binding schema of the website as the diagram 4-5 shows.
Figure 4-5: Site Binding.
b) Check the duplicate configuration option of a website.
To find the duplicate configuration option by comparing the Web.config file of a website to the Web.config file of the target site application program. IIS doesn’t allow the duplicate configuration in the website and its sub-application configuration file. For an example, if the cross-domain configuration is existed on the hosted website, you should remove it in its sub-application configuration file as the diagram 4-6 shows.
Figure 4-6 Duplicate Configuration.
c) New Site Application.
Right click the website and choose ‘Add Application’ action in the context menu as the diagram 4-7 shows.
Figure 4-7: New Application.
d) Test Settings by clicking the ‘Test Settings’ button
If you find the authorization error like the diagram 4-8 shows, you need to edit the application workspace folder permission as the diagram 4-9 shows.
Figure 4-8: Authorization Error
Figure 4-9: Folder Permission Settings.
e) Set Authentication
At final, we need to update the authentication for Web Site application as the Authentication & Credential section mentioned. For windows authentication, we should only enable windows authentication in the IIS Web Site application authentication setting center as the above diagram 4-4 shows.