Creating a simple wcf service publishing it to my webhotel, and get it to work - wcf

This seems to be a recurring problem to me. I want to get started doing wcf services. I create a new Wcf Service Library, compile it, and publish it using FTP to my providers webhotel. But its not working. I somehow cant get access. I dont want some fancy security model - i just want to get a hole through to my simple webservice. Seems that its the part when i publish it to my webhotel (in a subdomain) that breaks the webservice - its working perfectly when starting it locally.
How to proceed anyone?

Often you need confguration information to host a service. If the service is hosted in IIS, then you need that configuration in web.config. Are you updating Web.config properly? Some hosters don't allow it.
To address this problem you can set up your IIS-hosted WCF service to read its config data from elsewhere.

I wrote a bit about my findings, this solved my issue: http://www.vikingworks.dk/post/WCF-Service-on-hosted-environment.aspx

Related

Deploying WCF Library

I am sorry in advance for the question because it should be so easy for someone who has web programming experience, but for me ...
I have created a WCF library which gets an email address, subject and body and sends email using a gmail account. I do not know how I can deploy it.
I already published it on my host using visual studio but don't know what URL should I use to call it. Can I use it directly or I have to create a WCFapplication and add the service to it then publish the WCF app?
Also, I noticed the base address in its config file is sth like: localhost/emailservice/service1 and I am not sure if I should edit it or not and how.
Your help is greatly appreciated.
Since you created a WCF library, I am assuming that you are open to host it as an IIS application or as a windows service.
Assuming that you wish to host your library as an IIS application, follow the steps mentioned in this blog to host your WCF service library.
Please note: If you intended to host your service as an IIS application, it would have been far easier for you to create a WCF service application project in Visual Studio instead of a WCF service library project.

How to get events from wcf service loaded by mef to propagate exceptions to host (self-hosted)

I have a self-hosted WCF service which load its ServiceContracts with MEF. All works fine. I am also able to send error messages to the WCF Client, which is regarding the faults caused by the user. However I also want to capture all the exceptions that can be caused by the service itself and send them to the Windows service that hosts the WCF Services. In the Windows Service I would like to be able to use the logging system to write this exceptions to. I have already tried the example by David Anson. Another solution I came up with was by using MessageQueues, although I don't think it is a nice solution. Has anyone an idea how to solve this? Preferably with an example...

Looking for "ACS + SOAP WCF Service Hosted in IIS" sample

I've been trying to figure out how to host a SOAP WCF Service in IIS and protect it by ACS, but I keep running into problems with every single example I can find. For instance, none of the standard ACS samples (http://acs.codeplex.com) show how to do this. Instead, the closest example shows how to self-host a WCF service but does not show how to host the service in IIS. Other examples work fine but are either REST-oriented, or inexplicable or simply uncompileable. I have researched this a lot but I am clearly getting nowhere. What I really need is a detailed walthrough that works end-to-end. Any help in this regard would be greatly appreciated. Thanks....
AFAIK it boils down to getting the web.config correct. This is explained in the e-book http://www.microsoft.com/en-us/download/details.aspx?id=28362 on page 145 and following. You need to correctly configure the ws2007FederationHttpBinding on your web-service.

Consume a WCF service via HTTP POST and without a service reference

I am going to need a web service that receives a string via HTTP POST and processes it without any response to the client. However, since I'm not the one making the client (which will be cell phones) I am unable to use a generated client class to consume the service. The service would also need to be self hosted in a regular Windows service, if that matters.
As I'm not too experienced with web services nor WCF, I am frankly unsure if I can or should use WCF for this, but as it's the only type of web service I'm at least a little familiar with I figured it would be great to start out with one if at all possible.
I've been googling around quite a bit but haven't been able to find any good references to this, so I'd also be very grateful if someone has a link lying around to someplace that discusses it.
I think you need WCF Restful service with one way operation. Following link might help you:
A Developer's Guide to the WCF REST Starter Kit,

Self hosted cross domain WCF service called from silverlight hosted in sharepoint

as the title already states I am trying to call a self hosted WCF service (hosted in a windows service) from a silverlight 4.0 application which is hosted in sharepoint 2010. I use the basicHttpBinding and I already tried a lot of things as suggested here:
http://www.dotnetfunda.com/articles/article416.aspx
or here
http://blogs.msdn.com/b/carlosfigueira/archive/2008/03/07/enabling-cross-domain-calls-for-silverlight-apps-on-self-hosted-web-services.aspx
but none of them worked I still get the error:
An error occurred while trying to make a request to URI 'serviceuri'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. Please see the inner exception for more details.
The inner exception states:
when deploying an Office solution, check to make sure you have fullfilled all security requirements.
The two files clientaccesspolicy.xml and crossdomain.xml are accessible on http://myserver/clientaccesspolicy.xml and http://myserver/crossdomain.xml
Does anybody have an idea on how to solve this?
All these things helped me out. But the biggest thing for me was turning on Fiddler and tracing the request/responses from Sharepoint + Silverlight. I was getting a 502 error back for some reason. I noticed that my Url in my code was "http://localhost:", however the request from silverlight was "http://[servername]:" you would think that this should work, however it didn't.
I remembered I had run into issues before where "localhost" was giving me problems, thus what I did was to edit my Host file from /windows/system32/drivers/etc and simply add the line::
127.0.0.1 [servername]
I did a iisreset, I left fiddler running and I unchecked the Enable IPv6 option (Tools->Fiddler Options) and everything started working. The Clientaccesspolicy.xml could be accessed, and sharepoint + silverlight could call out into the wcf world :)!!!
There was one major issues however, when you turn Fiddler off, it stopped working... Now I have to figure this one out...
I hope this hellps you.