File-less Activation with wcf and add service reference wont work? - wcf

Hi I'm trying out File-less Activation with an silverlight solution, and when I choose add service reference it wont show up, I can browse the service with success in my web browser.

It won't automatically show up, vs.net uses the svc file to locate the service.
I need to do as Ladislav said, type the address into the vs.net service reference manually.

Related

Adding a service reference in VS 2017 15.9.14 windows forms application

I am trying to add a asmx web service to one windows forms app by following way ->
Right click- > add service reference.
But it seems the service is added under connected service folders only. not under service reference . Is this an expected behavior?
or are we supposed to use web reference instead of service reference for windows forms application?
To answer this question you need to know the difference between Webservice and WCF web service and you'll find that
Here.
Anyway, I'ts a noraml behavior, let's form that in another words, the Service reference will let you communicate with a WCF-based services whatever those services are, but with the web reference, you can only communicate with web services under some conditions.
I would use service reference always because it gives more options including those in web service, and it's the new-easy way.

Must I add a WCF service class library in order to host a WCF Service in a Windows service?

I read about how to host Wcf Service in a Windows service. There is a guide here:
http://msdn.microsoft.com/en-us/library/ms733069.aspx
But what I did was just to create new WCF Service class and interface inside the same project of the Windows Service instead of creating a new project separatly for the Wcf service.
Is it possible to do it? because I can't add a service reference to that service from other projects in the solution. It can't find it.
OK, here is what I found.
Creating a new solution with one Windows service project with a Wcf service class and one Asp.Net folder.
Running the Windows service.
Trying to add a Service reference to the Asp.Net project.
Result: Service can't be found.
Adding a new project which contains a Wcf project to the solution.
Adding a reference to it from the Windows Service.
Trying to add a Service reference to the Asp.Net project.
Result: Service found.
Reading this link:
http://msdn.microsoft.com/en-us/library/ms731758.aspx it's done similar to what I did in the test solution, but still there is a need to write some code in the Windows Service.
In this link:
http://msdn.microsoft.com/en-us/library/ms731758.aspx
They show how to host it without creating a separate project.
So the answer to the question is no, you must not, but you have to write some code for hosting the service and can't just use the configuration file.
Note the windows service must be running so you can successfully add the reference.

HOw to manage newly added methods into WCF service

I have created wcf service and added its refernece into web application project.
Have added as below way: 1. generated proxy and config file using - svcutil command and added proxy file into web application project and merged configuraiton file.
Now, I have added some new methodsinto the wcf service , do i have to use - SVCUTIL command on each time or it should work automatically.... for now, i need to generate proxy file each time.. please suggest some best way.
NOTE: service instance available into ASP.NET web applicaiton (client) but unable to get when use client as - MVC applicatoion. please suggest.
Thanks
In the Web Application, open the Service References folder.
Right click on the Service you want to update.
Select Update.
Thanks for the response.
I found the answer, when add service reference (for MVC application) >>> click at 'Advance' button >>> uncheck the "reuse object....." option and then add it.
Then, service client reference is available and it works.
Just for KS, sharing you another design issue due to Add Service Reference option at below link:
What should keep into this design approach
Thank You

Is it possible to use "add service reference" option to add a self-hosted service in WCF?

I am creating a WCF service. At first I had one WCF service library project and one console project which was referencing the this library. And it worked fine when I used "add service reference" in my client project, as long as the service library had a valid App.Config file.
However, now I want to combine the service library and the console host into one console project. After all, the previous console project was pretty simple. But here comes the problem: when I choose "add service reference" and give the endpoint I defined in the App.config file of the new console project, it can't find any service reference. I take it because the service will not be hostedd by wcfsvchost.exe when the add service reference function was on(and I think it makes sense). But I can't think of a way to make it work. So how am I supposed to add a service reference, if my service is one single console-hosted project?
The easiest way for you is to run WCF service, generate a service reference and then combine it into single application. All you will need to do is just change address in your app.config. But be careful with this, as you should change address for client part and not server part of app.config.
This approach, however, will be difficult to maintain in future, when you will decide to change your service data contract and regenerate service reference. You might want to consider the following: wrap service reference into assembly and use assembly instead. This way you will be able to regenerate you service reference whenever needed.

Questions about adding a WCF service to a Windows service assembly

I have found some basic information about hosting a WCF service in a Windows service, but not much. All of my experience thus far with WCF has been in Web projects. I have a few simple questions.
I have a project which creates a windows service application. I have done a right click -> add WCF Service. This creates Service1.cs and IService1.cs.
I'm wondering why no SVC file is created in this scenario? When I add services to Web projects i get an SVC file which I can navigate to and use to consume the service.
Adding the service adds some configurations to the app.config under the services element. I'm seeing a default base address of
http://localhost:8732/Design_Time_Addresses/WindowsServiceName.services/WCFServiceName/
What does this mean? It's sort of an odd looking address. Am I supposed to change it to whatever I want?
Navigating to this address in a browser results in an unable to connect message. Does the windows service itself have to be running to talk to the WCF service?
How do I go about consuming this service from another application without an svc file?
I'm taking a guess on this first one, but I'm thinking the .svc file when hosting in IIS is to tell IIS, "Hey I have a WCF service here, please handle accordingly".
The base address is as it should be and yes you can change it if I'm not mistaken.
You can't hit the WCF service unless the Windows service is running, which is one of the dangers of hosting in a Windows service, because if the service dies somehow your WCF service is offline until you get the Windows service running again.
You consume the service the same way you do any other WCF service, just using that base address to get at it.