0
votes

I have a Clustered Windows Hosting site which currently hosts an MVC Web Application using a MYSQL backing database.

What I have been trying to do for the past three weeks is host a WCF Data Service exposing the database behind the website to be consumed in a WPF application which will be installed on Windows machines.

I have followed every single tutorial that I have come across. None of them have worked and all of them give the example of using http://localhost as the location of where the Webservice is called from.

I have limited experience with Asp.Net and MVC but have published working websites before and as I mentioned currently am running a fully functional MVC web Application. I also have extensive .Net knowledge and experience, but, for the life of me cannot fathom this out at all.

I have seen no real examples of a WCF site being hosted from within a clustered hosting scenario. Practically every example I see mentions using IIS, but I do not have access to IIS on my hosting.

Could anyone point me in the right direction to a tutorial that will allow me to use a WCF service, or am I completely barking up the wrong tree?

Okay, an Update: After much experimenting I came across the following attribute and used it [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]

This gave me an error which appeared to indicate that the Data Service was trying to access files on my local hard drive, indicating that I'd fudged some kind of reference. I also realised that I hadn't set up the Membership profiles and so scrapped my Data Service starting again.

First I added the Asp Membership profiles, then the Entity Model, set the permissions and used that attribute again and although looking more hopeful still got the following error.

The exception message is 'The specified store provider cannot be found in the configuration, or is not valid.'. See server logs for more details. The exception stack trace is:

at System.Data.EntityClient.EntityConnection.GetFactory(String providerString) at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) at System.Data.EntityClient.EntityConnection..ctor(String connectionString) at System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) at RotaSolutions.WCF.Models.rotasolu_crmEntities..ctor() in C:\Users\Paul\Dropbox\Projects\WCF\RotaSolutions.WCF\RotaSolutions.WCF\Models\CRMModel.Designer.cs:line 34 at invoke_constructor() at System.Data.Services.DataService1.CreateDataSource() at System.Data.Services.DataService1.CreateDataSourceInstance() at System.Data.Services.DataService1.CreateProvider() at System.Data.Services.DataService1.HandleRequest() at System.Data.Services.DataService`1.ProcessRequestForMessage(Stream messageBody) at SyncInvokeProcessRequestForMessage(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

Although, still not able to use it. This is giving me more hope than previously. Again, if anyone has any suggestions, I'd be grateful to receive them.

1
Not sure if this would work in your case (with the cluster), but have you tried self-hosting the WCF data service? You could try writing a simple console app as a proof of concept.Tim
This is where my knowledge gets a little hazy. By self-hosting, do you mean say, creating an empty MVC application with a WCF Data service within it and using that? If so, yes, I have. I've a horrible feeling that I'm missing just one tiny little point here and I can't for the life of me see what it is. The only way that I've been able to make this work, was by following the classic Calculator tutorials. That was the only way that my WPF project could actually see the WCF Service. Every time I try to do it with a WCF Data Service, there are always faults.Darkly Pure
Okay. What I have done exactly is this. Created an empty MVC4 project Added an Entity Data Model called CRMModel Added a WCF Data Service called CRMService I added the permissions on the InitializeService method Pressed F5 and locally it appears to work fine. I then added this project to my WPF Project called CRM.WPF and discovered the service. I then published the service to services.myservice.com removed the MVC Project from the WPF and tried to access the service in code via this Uri Uri uri = new Uri("services.myservice.com/CRMService.svc/") This always gives an error.Darkly Pure
The main error 'The invocation of the constructor on type 'MyWPF.WPF.MainWindow' that matches the specified binding constraints threw an exception.Darkly Pure

1 Answers

0
votes

I have actually managed to solve this. I'd post the full answer but can't due to sever formatting problems with the editor here so I'll have to do the short version.

Basically, I removed the MySQL version that I was using, downloaded the latest version and installed and added that reference.

I also added to the web.config a DbProviderFactories linking to the MySQL reference. Like I said, I'd post the code but this formatting system keeps rejecting my attempts.