Web Service Reference not working in Windows Service application - vb.net

Mine is Windows Service project. But I've to use a web service in it which is working fine in Web application when I refer it.So I tried to add the web reference into my Windows Service project. It added fine. But the DISC file and wsdl file not being displayed. And also I was not able to use the webservice class reference in my application.
Any solution for accessing that web service in Windows Service app? Or I've to do anything else to make it work

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 call local WCF service from webpage?

I'm developing a webpage that is supposed to consume WCF webserice that is located on client's computer. First, user installs some software that hosts WCF service on his computer, then he'll view my webpage which is supposed to call the WCF service. Do you have any idea how to do it without having to use AtiveX and IE?
Add your wcf service as service reference to your web project. You have to specify the url of your wcf service. A clientproxyclass will be generated for you. In your webpages or whathever you can create a instance of this proxyclass and just code what you want.

Using a console application to host WCF endpoints that expose asp.net ProfileService, ProfileService and RoleService

I've got an MVC web application that is used as an interface to a Console based app that exposes a bunch of ServiceHost/s using the net.pipe protocol.
I would like to use the asp.net membership/role/profile provider to manage my users and their roles and profile information (Inside the Console Application). I've done this in quite a few apps, but normally I reference these providers directly from the web application itself.
This is a good walk-through on doing pretty much what I would like, except I don't want to host the WCF service endpoints in IIS, but inside my console app - which will eventually become a windows service. When I try and host the ServiceHost through my console application I get the following error:
This service requires ASP.NET compatibility and must be hosted in IIS.
Either host the service in IIS with ASP.NET compatibility turned on in
web.config or set the
AspNetCompatibilityRequirementsAttribute.AspNetCompatibilityRequirementsMode
property to a value other than Required.
Now it seems that I won't be able to set that property to anything other than Required.
I've tried another route which is using the wrapper class/interface defined here for my authentication service, which I managed to get wired into in my MVC app without too much trouble, but this doesn't cover my Authorisation (using roles) or profile needs.
Has anyone got a solution to this, I can't be the only one trying to do this? I'm not

Publishing a Silverlight with reference to a WCF

I created a RoleService in my silverlight project and through that got hold of the embership/Role functionality. I am running this on a local machine and is wondering how to publish this to my website. I have 3 web applications:
My main web application where the silverlight object shoule be merged into
The silverlight project which lets me develop the silverlight application
The silverlight host application which I use for testing
In the web application (1) i have made the RoleService so that i can get a hold on my Roles. In the Silverlight application (2) I have a service reference to the service mentioned above which I consume and loads my Role data. This howecer doesnt work when i publich it online. But how do i get it to work online?
Is it because it is trying to connect to service with wrong address? If so, then you just need to propagate WCF service address to your Silverlight application through hosting web.config and start connecting to a correct service.
Let me know if this is the case, then I will share exact solution for this.