Run a webservice inside a windows service not IIS - c#

creating my first webservice and need some assistance. i'm trying to create a web service to send data on a machine that doesn't have IIS. I have seen examples of this on msdn Host web service outside IIS.
My question so far is the address for the web server as the one in the example uses Http://localhost/WSEHostedWebService, i'm not sure what to use here as there is no web application or even IIS running on the intended machine. Should this point to a directory on the intended machine i.e. c:\webservice\myFirstService.asmx ?

To quote them "The following code example creates a Windows service named WindowsServiceToHostASMXWebService that hosts a Web service named Service at the soap.tcp://localhost/Service endpoint." - Try saying that fast with a mouth full of water :D
Anyhoo, unless you specifically need ye olde worlde asmx service do it in a WCF web service inside a windows service instead read this and this other link with example
As the link above says WCF handles the HTTP stuff outside of IIS anyhow.

Related

Using a URI to access a SOAP webservice instead of IP

I have a test web-service: https://r3reports.retain3d.com/API/Reporting.asmx
In my production i have the following structure:
- IIS Application for my main application
- IIS Application within the main application for my webservice
When running from Visual Studio, my app is able to talk to the webservice without issue (it is pointing at the url above, not a locally hosted version). BUT when it runs in production, the TEST call times out because it is trying to use the IP to get to the webservice instead of the URL name (which is what is configured in IIS for SSL purposes). What am i doing wrong and how can i force the SOAP call to use the URL instead of the IP?
Fixed it, turns out we had to modify the host file on the server to properly map the child app to the right IP (it was resolving to the external IP which wasn't bound to my application instance)

C# Web service works in console but not from asp.net website on IIS server

I'm using a web service which works fine when I run it on my machine in an ASP.NET application using the default IIS Express VS 2010 comes with. However, when I move it to our server with IIS I get the error:
Error: There was no endpoint listening at 'web service name here' that could accept the message. This is often caused by an incorrect address or SOAP action.
'web service name here' is just a placeholder I put for this post. It has the right web service name.
So I pulled out the small login code that this is failing on into a console application and ran that from the IIS server and it worked! So I have to assume this is some kind of permissions issue with the IIS server on how it's running my web service code? In my ASP.NET program I have a separate DLL that handles the web service. The ASP.NET application fires off a separate thread that uses the DLL I made that uses the web service. Is it something to do with the separate thread permissions maybe? Any ideas?
Your first step when faced with this sort of issue is to search your config files for "web service name here" (or if this isn't actually the message you're getting the address given in the message). My suspicion is somewhere you'll have a WCF reference set up which needs a proper IP address.
Once you've got the address (assuming it looks valid) you need to check you can access it from the machine which is having the difficulties - it may be a firewall issue.
Now that you've established that your console application is connecting correctly from the same machine the next step is to check that both your IIS App Pool and Console application are running under the same user account/permissions. It may be that one identity has permission to access the network/internet and the other one doesn't.

Creating a Web Server container to emulate an IIS server

Okay, I'm a very green developer (co-op student) so I'll try my best to make sense. Currently I have a web application (call it "Updater") that is an aspx and runs through IIS. My boss has asked my to look into creating a program (exe or command line) that can run the app through created encapsulated web server that can act like IIS. This is so that I can run the exe during an installer procedure on a client's machine so that the updater can configure the client's program.
So Far I've looked into sources upon sources on how to create a self hosted web server to handle a web app and I've managed to do the following:
-Create a command line server hosted at a given port #######.
-Use a StreamReader to read an html file
-Use HttpResponseMessage to set the Content to this html page.
Obviously this is very rudimentary, but I couldn't understand how to switch the app over to the server I created rather than the IIS.
Any help ont he matter would be appreciated, like I said I'm still quite new.
You can use OWIN to self host from within a console application.
Look for 'Self-Host OWIN in a Console Application' in the following link:
http://www.asp.net/aspnet/overview/owin-and-katana/getting-started-with-owin-and-katana
You need to start you self host server with the address your app is trying to contact. If your IIS is running with the default settings it should be http://localhost:80. Before you start the self host server you need to shut down your IIS website that is running on port 80. Two applications can not listen on the same port at the same time.
What you ask is a redistributable web server for ASP.NET. So, you might find interesting the UltiDev Web Server, formerly known as Cassini web server.
From their website:
UltiDev Web Server Pro (UWS) is an advanced, redistributable web server for Windows that can be use as a regular web server to host web sites and ASP.NET applications, or packaged with your ASP.NET web application and installed on your customers' systems along with your web app or site.

C# Trying to add a service reference to a WCF service I built on a remote server. Get Access to the path '...' error

I've been going crazy over this one! I've googled this problem and read everything that pertains to this but no luck! I've developed a WCF Service and a test web site to test this service with. These two work together very well (on my machine) when I add the service reference to the test web site, but when I publish the WCF Service to a remote machine and try to add that service reference I get an error that states:
There was an error downloading '\SNMCDEVTEST\sslroot\EncompassService'.
Access to the path '\snmcdevtest\sslroot\EncompassService' is denied.
This is behind the SSL (versus wwwroot) part of the remote servers IIS. I have a self-signed certificate attached to the server and a new application pool attached to the WCF service. I've made sure that everyone has access to this folder, but I still keep on getting this error!
Thanks in advance for your help.
Steve

How to debug WCF service with Silverlight

I have two solutions, one is the WCF service and the other one is the Silverlight.
I would like to use the debugger on both solutions at the same time. The debugger for the WCF service automatically starts a ASP.NET development server. However, I have a hard time making my Silverlight client connecting to the ASP.NET development server. The error says that I'm lacking of the client domain policy file.
Does anyone know where should I put the clientaccesspolicy.xml for the ASP.NET development server?
Thanks a lot!
clientaccesspolicy.xml needs to be in the root directory for the web server running the WCF service. In your case, this probably means the solution directory for the WCF application (if you're running the web server "in place").
You could also try using Fiddler or Firebug to determine exactly where the file is being requested.

Categories