Calling a locally hosted web service - c#

I have a web service on a virtual development machine. This - as you would expect - works fine and all of my web methods are called and return as expected. Now I wish to call this web service from my base machine but I'm not sure of how to go about doing this.
What is the correct procedure to carry out the above?

you need to deploy the web services on IIS, you can do it in multiple ways one by using publishing utility

Related

Should a hosted service be used in an ASP.NET Core Web API project when that service has to run before requests are made?

I've added a hosted service to my ASP.NET Core Web API project:
services.AddSingleton<IHostedService, ScheduledProcessingService>();
However, Main() and Startup don't get hit until a request comes in. That means my hosted service doesn't start until then. When running locally, when I start the app, I have to make a call to the API controller (which I'd like not to have to do) in order for the hosted service to run.
If my hosted service has to process, regardless of whether a web request comes in, is it wrong to put that service in a Web API project? Should I create a separate project for it?
I could change some IIS settings, like in this post, but I want to make sure I'm doing what's right.
Unless someone provides more clarity, I think this is the answer:
It's hosted in IIS so it's just how it works. To overcome this, I think we'd have to set up some automatic ping, hangfire.io, or simply putting it in its own project that is just a service.
Another option would be to change these settings on the app pool:
.NET CLR version: v4.0 (instead of no managed code)
Start mode: always running
Idle time-out: 0
Another suggestion:
We use the app initialization feature in IIS to start and keep the services running.

Publishing multiple web services to the same Azure VM

Short story:
Can I publish more than one WCF web service to a single Azure VM? When I publish one, it appears to "overwrite" the other (I can use the new one but old one stops working).
Longer Story:
I have a web service which I published to an Azure VM and it's been working well. I recently started building another web service as another project in the same solution as the original web service. However, it doesn't seem that I can host more than one web service on the same Azure VM.
Let's say I publish service A and test it to make sure it works. Then I publish service B, and that works too. However, that causes service A to stop working. If I republish service A then that causes service B to stop working.
This leads me to believe that you can only publish one WCF service to an Azure VM at a time, unless I'm doing something wrong?
I could combine them both into one service, but I really don't want to do that as the business logic and purpose is different for each one. Is my solution to have a second VM?

WCF Service with Web Page not possible?

I have created a WCF Service and it's running just fine. I have the link that takes you to the Manager Service page in order for someone to get the URL for this service.
I have added a controller/cshtml page in order to test (ping) the databases that are used by the service so that we can check if they're up and running (the databases that is).
When I run the service locally with IIS Express, it works just fine.
www.domanin.com/ServiceName/Manager.svc is the URL.
When I run locally this ping (cshtml), it's localhost:XXXXX/Status.
Status is the name of the controller. And this works! (when I run locally).
Why does it not work when I publish it to a Server?
I try to go to www.domain.com/ServiceName/Status and I get a page cannot be found. I've also tried www.domain.com/Status and nothing. Can you not have a razor (cshtml + controller) hosted together with a service?
Thanks!
It sounds like your routing is not configured correctly most likely your mixing your wcf and mvc configurations and somehow it got messy. If you add .cshtml as an iis mime type on that remote server I suppose you could see a response.
I suggest that you create a folder under the root and make another iis application and place the test app and configuration in its own location if that is possible. You can still share code that way but will not have the overhead of opening the mvc pipeline for requests to your wcf service.

Hosting non web based application in IIS 7

I have heard that you can host non-web based applications in IIS7 similar to windows services. Basically I want a C# app that is just a process running all the time to perform a specific function. I want to create a process that connects to the database at an interval and does some work.
I would like this whole app to be housed inside IIS. Is this possible? Can you provide me with links and resources to get me started?
WCF services can be hosted in IIS. Abstractly, think of them as webservices. Really much more, than that, but it gives you the gist. More information:
How to: Host a WCF Service in IIS
Why we use wcf rather than web services
How To: Hosting a WCF Service in IIS
Take a look at AppFabric it's Microsofts Application Server
http://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx
http://www.hanselman.com/blog/InstallingConfiguringAndUsingWindowsServerAppFabricAndTheVelocityMemoryCacheIn10Minutes.aspx

Problem connecting to java ws

I've created EJB Stateless Bean and have added #WebService, #WebMethod
annotations to be able to access it as web service. I am using
NetBeans and GlassFish. When I tested web services with server console
they worked as expected. Next I've created .net application which is
supposed to be client for my web service. The problem is when I have
more than one method in the web service it does not work. When I
remove all method except one it works ok.
I also created for test purpose not EJB based web service - web
application project with added web service. This version works ok. So
am I suppose to do something at client side or server side to make the
EJB version works?
Unless explicitly told to, the web service libraries in Glassfish produce SOAP11 WSDL's, and most .NET-tools expect SOAP12.
If you cannot make your .NET-tool understand SOAP11, it appears you must adapt your sun-javaws.xml file. I have not tried this myself.
See https://metro.dev.java.net/1.4/docs/soap12.html

Categories

Resources