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.
Related
I'm trying to create a ASP.NET core app which is hosted in a Windows Service, following the official documentation.
The only difference I made is that I used Network Service account, and made Kestrel listen to port 10090, instead of the default 5000.
After publish the binaries to the server(Windows Server 2012 R2), everything works fine via local access(on the server using http://localhost:10090/), but the web cannot be accessed on other PCs. Showing
This site can’t be reached
server-1 took too long to respond.
This server also has some IIS hosted web application and they are working fine.
Does anybody knows the missing points I made? Thanks!
With help from my colleague I found that it is a programming issue.
When creating the IWebHostBuilder in Program.cs, I wrongly set the option of Kestrel (copy and paste from official documentation):
options.Listen(IPAddress.Loopback, 10090);
While one of the correct option is IPAddress.Any.
I work as a C# developer and we have many .NET web services that we use. I am doing some at home development and want to do something similar. I have a database (SQL Server 2012) on a home PC running Windows Server 2012 with IIS 8 installed. I have created a WCF web service in Visual Studio (C#) and it compiles to a .svc file. This just facilitates data exchange between my SQL Server Database and the application I am writing.
I am unfamiliar with how to host the WCF service so that the Windows Form application that I am writing that will be installed on many non-local machines can access it. I figured a WCF service would be the best choice for accessing my database for the WinForm application over the internet.
I also have a domain with a basic Windows package on 1&1.com leftover from a previous project if that helps.
Can anyone give me some steps to get my WCF service hosted so it can be accessed over the internet? Please ask if I forgot to list any needed information.
Two common ways are to host your WCF service from IIS, or to self host it yourself from within a simple wrapper program that acts as a TCP server.
See http://msdn.microsoft.com/en-us/library/ee939285.aspx
The simplest way is to setup IIS and just publish your services like you would a web application; your service will exposed over http/https. Use an appropriate binding like wsHttpBinding or BasicHttpBinding depending on your security needs. Read up to understand the different bindings and what each does and does not support.
In order to host WCF via IIS, at least on Windows Server 2003 and 2008, make sure you follow the install steps, such as adding .NET 3.5.1 / WCF options on older platforms. I believe Server 2012 includes it within .NET 4 framework, but I haven't yet done it on 2012.
Google "WCF hosting IIS" for steps / setup guides.
There are also hosting providers that specifically provide WCF hosting solutions, though I'm pretty sure your current provider, since it supports IIS, should do fine.
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.
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.
I am hosting web service in a one machine using Visual studio 2008. I tried accessing the web service from a web site i created in the same solution and it was successfully called. Now i want to access the web service from a remote client.
I initially developed the web service to used in an android application. As you can see if I wan to access the web service I will have to host is with a static IP. So at least to test the application i want access the web service from the android mobile by connecting both server and android mobile to one wifi network. For the initial test I connected two laptops(one is server) to the wifi router. And i pingd the server from the client machine and it got successfully pingd. But when i try to access the web service with given port from the browser it wont allow me to connect. I tried http://localhost:26796/ by replacing the localhost with ip of the server and also i tried making a small web site(asp) and try to access it from the client via IP. Both did not work. I have searched here and on web could not find a proper answer. for,
how to host a webservice so other clients in the same network can access..?
can it be fulfilled with VSD server..?
is it compulsory to use iis..?
How should i achieve this..?
NOTE: Moved from comments to answer as per user suggestion.
Publish the web service to your local machine's IIS as an Application. Then you can access the site from anywhere in your network. Running it directly from VS means it's hosted inside VS's ASP.NET Development Server (which, by default is only accessible locally). You can try opening up the port specified in the ASP.NET development server that starts up on your machine's local firewall, then you can access the debug instance being hosted