Want to run my own server instance with special port for an ASP.Net 4 based solution - asp.net

I have made an application in asp.net which sends and receive sms, it works very similar to desktop application and it will be installed on servers to send sms alerts, but the problem is if server does not have iis, it will not work. I have seen many apps which when installed, have their own server and port, you do not need to install any IIS, when you just double click it starts running on a special port and works well, similarly visual studio also runs its own port in development mod, so what is the best way to make such solution for an asp.net product.

If you're talking about how to host a service in an application outside IIS, Windows Communication Foundation (WCF), which allows you to host a service in a Windows Forms executable, Console Application, Windows service, or IIS.
It's too big a subject to explain fully here, but there's a nice starting point here.
This will allow you to create the host, and allow you to hose services similar to web services, but with more options for how to connect. (http, tcp, etc.)
But it's not an ASP.NET host. For that, you will need a web server that can execute ASP.NET, such as IIS. There's no way to get around the need to have a web server, whether it's one of the many already established, or if you write your own. I believe there are extensions for Apache that allow you to do so via Mono, but I've never used them. Writing your own would be, in my opinion, a waste of time and a bad idea.
The simplest solution by far is to specify that IIS instaled with the appropriate framework is a requirement for using your website.
Edit
However, if you REALY want to write a WinForms app and have it host ASP.NET, it looks like this previous question has an answer that would help. You can use the Cassini web server, the same one that Visual Studio uses.

Related

Manage localhost ports when developing with Visual Studio with several users on one machine

In our Visual Studio development (VS2015), we share one virtualized machine with several developers. We had to solve several minor problems with this setup but discovered a more annoying problem now.
Our solution consists of a client that uses web services, that are implemented in a ASP.NET project. When we start our client, we also start the services so that the calls can be made from the client. The services get started on the localhost port that is entered in the project properties. But when we work with several developers we have the problem that Visual Studio would use the same port for all developers and as we are on the same machine, the web project will not start because the port is already used. We now have following questions:
We can separate the ports by editing the IIS config file but we also have to change the port in the client and after each checkin all developers again have the same port.
1) Is there a clever way to manage the ports in the local IIS express?
2) How can we configure the ports in the clients so that the configuration is not overwritten by each checkin of other developers?

Deploy a desktop application from a web site

I have a requirement to install a desktop application written in visual c++ when our customers log in our asp.net web site. The desktop app will be installed once, but will be updated as a newer version is available. What is the best way to do this?
My second question is that is there a way for my asp.net web app to interact with a window service installed on customer computer and direct the window service to control USB devices.
My work uses software by a company called Citrix. There is some client side software that goes on the client's PC. When setup correctly, we can click a link on our sharepoint site that will trigger the citrix client software to launch a WPF desktop application from a network drive that will run locally on the clients computer (might be in a virtualized space that Citrix creates). This seems to work well, it runs our WPF applications that use windows authentication. This is all I know about it. You can research more if you're interested.
To answer that second question... Your window service would need to expose some kind of service for the client (asp.net web app) to communicate to it with. So ideally I think setting up the windows service to host a WCF service inside it and use something like named pipes or HTTP protocol to communicate with your application. I don't know what kind of USB devices you are trying to control though, that will take research on your part. But if you can control them with a local console application, you should be able to do the same with a windows service.
Good luck. Hope this was helpful.
You can't install an app from a web site, best you can do is prompt the user to download the installer. And asp.net (or any website in general) can't interact with the window service on the client. Imagine going to a website which changes your service settings, installs viruses, etc. A website is pretty much limited to changing cookies and local storage on the client, anything else on the client is inaccessable.

How to run a leightweight ASP.NET MVC application that would be accessible only locally (not on IIS)?

We have a desktop client application and recent customer requests indicate that they would like to have some dynamic HTML content served and displayed by the application.
We are considering hosting a simple ASP.NET application in a local process, accessible only from the local machine (similar to the ASP.NET development web server used when debugging from Visual Studio).
How can we run an ASP.NET application locally without IIS? IIS is not an option because most client machines will not have it installed.
Is there a leightweight ASP.NET web server that could run locally similar to the development web server that VS is using?
I have found some information about "Cassini". Is this suitable for production use? Can it handle ASP.NET MVC? Are there any alternatives we should consider?
I have not used it myself, but you can try the mono XPS server.
It is a stand alone webserver.
The easiest way to start XSP is to run it from within the root directory of your application. It will serve requests on port 8080. Place additional assemblies in the bin directory.
Cassini is in fact also a good option - it is the development web server that comes with visual studio (so widely distributed, used and tested) and is also used by the open source ScrewTurnWiki. See wikipedia.
In regards to your "only locally" requirement - a web server will serve any request made to the right port. In order to limit accessibility, you should use a firewall that will block any external requests.
You might consider using WCF to host a service on the local machine that can serve the data without having to host a full blown web server.
If you do this, WCF allows you to expose the service with multiple endpoints and make it available through HTTP, TCP, or Namepipes. Namepipes would restrict traffic to only the local machine.
I have also tried IIS Express. It works great with ASP.NET MVC. Right now it is available only with Web Matrix, but installing web matrix is easy.
Coming back to this question three years later, ServiceStack.NET with self-hosted option seems like a good choice. While it is not ASP.NET MVC directly, it provides a good API and features are on par with ASP.NET MVC/WebAPI (or in some ways better).

asp.net application that manages an ftp server

I have a requirement to build an application that a company can use to manage an ftp server. The idea is that through the web app, they can create users which will also create an ftp space etc so that the user can then upload documents and files to the company. The requirement is specifically that clients can use an ftp program and the company manages it through a web application.
I know Plesk provides an API which could be used by an asp.net application, as well as being able to work with IIS directly etc
however, can anyone suggest:
- a .net library that makes this straight forward (or just tell me that IIS is the best way to go)
- a package that does this (even if it costs)
- an alternate ftp server (not the IIS one) that may make this easier
- examples of .net code managing the IIS ftp server
- "just use plesk"! but really, plesk has too much in it, really I just want the ftp management part of plesk
assume it would be running on a windows server with complete control...I was just presuming that I'd interact with the IIS ftp server but cannot find any real examples of managing the ftp side of things (mind you, searching FTP IIS and .Net etc gives a real mixture of results)
thanks heaps!
(do you always find stuff after you ask?)...
This looks exactly what I'm after...
http://learn.iis.net/page.aspx/285/provisioning-sample-in-c/#CreateFTP
But I'm still open to what's out there...has anyone implemented code similar to this?
This would be the best place to start with IIS7: http://msdn.microsoft.com/en-us/library/microsoft.web.administration%28v=VS.90%29.aspx
we've recently started using WinSCP's (winscp.net) scripting/command-line interface (CLI) from Windows Scheduled Tasks calling standard Windows batch files, but i noticed they also have a howto for c#:
C# example link: winscp.net/eng/docs/guide_dotnet#full_c_example

ASP.NET Development Server or Localhost IIS?

Currently our dev team set up all the websites they're working on in IIS on their local machine. We're thinking of switching to using the built in ASP.NET development server instead.
Is this a good idea? What are the pros / cons of using the ASP.NET dev Server? Are there any gotchas we should be aware of?
Thanks.
NB: Running on Win XP / IIS 5 / VS2005
Edit:
Didn't realise it was called Cassini.. More answers for Cassini v IIS here.
There is nothing that the ASP.NET Dev WebService can do that IIS can't (You can set breakpoints etc, just attach the VS debugger to the ASP.NET runtime).
However, the ASP.NET Dev WebService does not represent a true production environment, and as such you can get caught by gotchas that you wouldn't expect when you deploy to production.
Because of that, I mandate that all development is done using IIS on a local machine. It doesn't take much work to configure a site in IIS.
It's a very good idea. Here are some reasons for:
You no longer need admin access to your machine for web development (it can still be helpful).
It's much easier to test a quick change and continue work, and faster iteration cycles are good.
It can simplify setup and deployment of your development environments.
The XP version of IIS has limitation that are not present in the Server version that Cassini side-steps.
The only argument I know against is that there are a couple very rare edge cases where the Cassini built-in server doesn't exactly mimic IIS because you're using odd port numbers. I doubt you'll ever run into them, and using Cassini as the primary dev environment does not preclude developers from also having access to IIS on the machine. In fact, my preferred setup is Cassini first for most small work, then deploy to my local IIS for more in-depth testing before moving code back to the shared source repository.
[Edit]
Forgot about url re-writing. You do need IIS for that. And an example of a limitation of the built-in XP IIS is that you are limited to one site in XP (can have multiple applications, but that's a different thing).
I had to switch (back) to IIS for one project, because I needed to set some virtual directories which is not possible on the ASP.NET Development Web Server.
As I stated here: https://stackoverflow.com/questions/103785/what-are-the-disadvantages-of-using-cassini-instead-of-iis your developers need to be aware that Cassini runs as the local user, which is typically an admin account for developers. The development will be able to access any file or resource that their account can, which is quite different from what they will see on an IIS 6 server.
The other thing that's a pretty big gotcha is debugging web services is much easier using IIS and vdirs rather than separate Cassini instances.
I know at one point I had an issue with Authentication not working as expected on Cassini (built in development server)
Also, if you need to test things like ISAPI plugins (a re-writer for example) I'm not sure how that's done on Cassini.
The constantly changing port is also rather disconcerting to me. Also, for each web project in your solution it fires up another instance of a Casini server, and each one takes anywhere from 20 to 50 MB of memory.
I use IIS all the time, it's pretty easy to setup, and you guys are already doing that...
I've used both methods and I prefer having IIS locally vs. using the built-in server. At very least you're more consistent with the final deployment setup.
Also, when using IIS 5.1, be sure to get JetStat IIS Admin, it adds functionality that is disabled out of the box on IIS 5, such as being able to setup multiple sites.
I have run into the following limitations with the asp.net dev server:
does not support virtual dirs. If you need them in your app, IIS seems to be your only choice
Classic asp pages dont run in dev server. So if you have a mixed web app (like I have at my client right now), IIS seems to be the solution
If you need an admin UI to configure settings, IIS works better
Of course IIS requires that you be a local admin.
Another distinction I noticed is that Cassini runs as a 32-bit process and you have no control over it, whereas you can control the application pool of your IIS app to disallow 32-bit (assuming your IIS is running on a 64-bit server). This becomes especially important if your web application is going to call APIs in 64-bit processes such as SharePoint Foundation/Server 2010. When you debug your web app with Cassini as your debug server, you'll get "The Web application at url could not be found. Verify that you have typed the URL correctly" type errors when instantiating objects. If you debug using IIS with the app running in an app pool that runs as 64-bit with an identity that allows access to sharepoint database then you'll be able to debug properly.
In VS12 the development server is way slow, takes a few seconds to download a 2kbyte file. This did not happen in vs10. When you have a bunch of jquery files and css this is a real problem. Also every page requeries all the css/js files. Very very slow regression testing.
The main issue I've run into with the dev server is SerializationExceptions with custom security principals stored on the thread context. Details here.

Resources