Having problems deploying my WCF service library to IIS7 for my sync framework application.
-
14 июля 2012 г. 0:41
I can really use some help with the typical scenario SQLCE 3.5 DB against a SQL 2008 DB. I believe I'm very close, . . . The components that I have created are:
WebHostSync - The main WPF application.
WebHostSyncLib - The class library that contains the EDM model and implements the Sync Framework.
WebHostSvcLib - The WCF Service Library.So far, it works (so I assume the WebHostSvcLib is correctly configured and will not need to be changed). I can make changes to the EDM model in WebHostSync, call the
syncAgent.Synchronize();
and the SQL CE DB is synchronized against the SQL Sever DB. It even works against my hosted ISP SQL Server database tables.The only issue is that my WCF Service Lib is running against my VS WebServer. What I want is to move it to a Webservice hosted at my ISP. But I'm not there yet. I am trying to move the WCF Service Library to my Windows 2008 IIS 7 Virtual machine as the next step before going to my ISP.
The process that I am using is:
1. on my IIS 7 box, (192.168.111.6) create the following directory structure:
192.168.111.6/WCFServices/MyProjectService/
Where WCFServices is a virtual directory and MyProjectService is converted to an Application.
2. Within the MyProjectService, I have two files:
a. MyService.svc that contains:
<%@ ServiceHost Language="C#" Debug="true" Service="WebHostSvcLib.WebHostCacheSyncService" %>
<%@ Assembly Name="WebHostSvcLib" %>
b. A web.config file that is a near exact copy of the app.config located in WebHostSvcLib (not WebHostSync).
3. I created a subdirectory under MyProjectService named bin. It contains
a. the WebHostSvcLib.dll
b. Microsoft.Synchronization.Data.dll (it took me two days to figure out that the error:
"The type 'WebHostSvcLib.WebHostCacheSyncService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found." was complaining that the dll was missing!)
4. Back to the main application, I figured that I only need to change the endpoint address to point the the IIS server instead of the local VS server. So in the app.config file located in WebHostSync I changed the client endpoint address from:
<client>
<endpoint address="http://localhost:8732/Design_Time_Addresses/WebHostSvcLib/WebHostCacheSyncService/" ....
to:
<client>
<endpoint address="http://192.168.111.6/WCFServices/MyProjectService/MyService.svc/WebHostSvcLib/WebHostCacheSyncService/" ....
It doesn't work and the application cant find the service.
I'm either really close or thinking about this the wrong way, it might be as simple as an incorrect address, I've tried to figure it out, but nothing seems to work. Can someone help me out?
ThanksRobotuner
Все ответы
-
14 июля 2012 г. 23:49
I decided to move the service to an ISP to see if it behaves differently. I am getting the following error:
Security.ServiceModel.Security.SecurityNegotiationException: The caller was not authenticated by the service. ---> System.ServiceModel.FaultException: The request for security token could not be satisfied because authentication failed.
I am using what is created for me when I add the service as a reference to my project:
<client> <endpoint address=http://www.xxxx.net/WCFServices/RegattaDBService/RegattaDBService.svc binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IWebHostCacheSyncContract" contract="ServiceReference1.IWebHostCacheSyncContract" name="WSHttpBinding_IWebHostCacheSyncContract"> <identity> <servicePrincipalName value="host/xxxxx.xxxxx.com" /> </identity> </endpoint> </client>
Does anyone have any suggestions?
Thanks
Robotuner
-
16 июля 2012 г. 15:42
OK, Still working on it, but I have made progress. As it turns out, no-one mentioned anywhere that when you deploy a service to IIS7 (or any website, for that matter) that uses sync framework, you have to place the service dll AND the Synchronization DLL's. In testing, I also needed Microsoft.Synchronization.Data.dll, Microsoft.Synchronization.Data.Server.dll, and Microsoft.Synchronization.dll in the bin folder.
I'm at the point where I can get the service to run on my IIS7 VM, but am getting authentication errors on my Host ISP website. The error message is my last posting to this thread. I am also finding that <identity> . . . . </identity> does not appear to make any difference in my access to the wcfservice or anything else. Can someone explain to me how that is used?
Robotuner
-
17 июля 2012 г. 2:55Модератор
its a given that when you deploy the service, you have to have Sync Framework installed on that machine and other dependencies. its true for any WCF service, the svc file does not contain code that can be executed.
how does you config look like on the server? how about your bindings?
- Изменено JuneTMVP, Moderator 17 июля 2012 г. 2:55
-
17 июля 2012 г. 4:36
Hi:
Thats interesting. I am testing against a win 2008 server running IIS7 virtual machine. My service/bin directory contains the Sync DLL's mentioned above and it works fine. I am able to sync the local SQLCE database to a remote SQL Server database with just those DLL's include in the service/bin directory. Are you saying that I'm lucky, that my 2008 Server box actually needs the sync framework installed on it to work correctly?
The reason why I'm asking for this clarification is because the same service fails on my ISP's hosted website (also win 2008 server with IIS7, with even the same directory structure) with the above authentication failure. I've been trying to figure out why for several days.
Thanks.
Robotuner
-
17 июля 2012 г. 7:07Модератор
yes, you need to have sync framework installed.
see this link on deploying Sync Framework: http://msdn.microsoft.com/en-us/library/dd937085
you're authentication error is completely different from requiring the sync framework runtime components.
the error you're getting has nothing to do with Sync Framework as you havent even executed sync framework related code. it's a WCF error.
-
18 июля 2012 г. 13:28
I thought I responded yesterday, . . . to be clear, I need to have the sync framework installed on the web server? yes or no? It is running the wcf service correctly on my Virtual Machine server without being installed, the service is failing when installed on my host's webserver, which you say is a wcf issue and not an sync framework issue. I do not want to ask my isp host to install the sync framework on their server unless it is really necessary.
Thanks.
Robotuner
-
18 июля 2012 г. 13:58Модератор
I think i already said yes to both. The sync toolkit is built on top of sync fx 2.1, so you need sync fx installed. Look at the stack trace of your error and you will find the error is not raised by sync fx.