How to run ASP.NET C# web application locally? - c#

For a web application I am using ASP.NET C# (OS- Windows7, .NET 4) and the task has done. But I don't know how to run it locally in Windows7 as well as in Server 2008(.NET 4 and IIS installed in server 2008). And I have to run it in both the platfrom. So any help please. Thanks a lot.

If you have IIS 7 installed on your Win 7 machine, then:
Open you project in VS.NET
Right click on your project's node in solution explorer and choose "Properties"
Switch to the "Web" tab.
Select the radio "Use Local IIS web server"
Click the "Create Virtual Directory" button
That takes care of getting your application to run using IIS. You can also develop/debug ASP.NET applications like this.
As regards, deploying your ASP.NET application, after making sure all pre-requisites are installed. You'll need to use IIS Manager to create a website and associate that website to an application pool.

At first you need .NET 4 Framework on the local computer and you have to add the IIS functionality from Windows 7 corresponding add/remove software (activate functions). I presume you have Windows 7 Pro, because the home / basic edition aren't supporting server / development task like those.
If this tasks already is done, i think you just have to put your files into the iis (standard) inetpub folder (c:\inetpub\wwwroot). You can configure IIS in Windows 7 on mostly the same way as in Windows Server 2008.
Because it appears that you aren't a user of Visual Studio I would also recommend trying Visual Web Developer Express or WebMatrix. Both of those ships with an internal webserver that starts/stops themself while debugging the web application.

Related

How can I run an mvc app on windows server?

I'm really new at this, never hosted an app before, everything I've done so far has been locally.
I have a windows server 2008 sp1 running at work, with IIS installed. I access to it via remote desktop, and I need to be able to deploy my app, first locally on the server, so computers that can access it (through LAN) are able to use it.
Right now, if I create a folder and put some data in it, with an html file, and go to "localhost" in a browser, I can see the rendered html file.
The version installed is IIS 7.0, and my app is uses the MVC pattern, and .net framework 4.6.
If on my windows 10 PC I start my app (vs 2017) I can see it on my browser.
I want to be able to do what I do in my PC but on the server. How can I do this?
Update:
I tried Publishing the app through vs but that is on my windows pc and getting a lot of errors. What I know so far is that a guy from Networks gets the app by the developers and they publish it, but I don't know what kind of files does he need.
I followed tutorials but I just can't apply them.
As I said earlier, I have visual studio installed on my w10 PC, and tried publishing through that app to the ip where the server is, getting a lot of errors.
I don't know what to do, I'm really trying a lot of different things, but I don't even know how the app is supposed to look to be run in any way that is not how I run it in visual studio.
UPDATE:
I'm getting this error when I try to publish locally
Here is the Outline of what we need as per OPs requirement
In VS publish the App to a folder
Sort out the server prerequisites:
Turning Windows Feature On or Off for ASP.NET, ISAPI filters, ISAPI extensions, NET extensibility
Server should have .NetFramework installed
Copy the published folder to the Server
Configure IIS manager to add a new site and set physical path to published folder

.Net Core 2.1 project doesn't use scaffolded Identity when deploying on IIS, instead uses an old template from 2016

My problem is the following, I have a pretty huge project where I've deployed The Identity Scaffolding, so it has scaffolded in The Areas map. When I run this project in IIS Express on Visual Studio 2016, everything works fine, but when I published it and deploy it on IIS 10 on my local pc or on an remote server with Windows 2016 and IIS 10 installed on it, he refers everytime to a default template of inlogpage.
How it looks on IIS Express and how it should look.
This how it looks like.
I deploy it in the local IIS Express of Visual Studio but it doesn't in the normal IIS. IIS Express
Scaffolded Identity
Update project is finally running had something to do with the roles on sql server, but still it doesn't explain why he isn't taking my changed my login page
Right page
Default page
Those seem to be different projects, see the year and the project name in the footers. To deploy to IIS, consider using the Web Deploy method instead the File system method. See Deploy the app for further information.
Make sure that your site is using the same folder by click on the explore on the site.
do not forget to refresh the site after publishing from the visual studio.

Host ASP.NET MVC4 website in windows without VisualStudio or IIS installed in it

I have ASP.NET MVC4 published as a file system. I need to host it in a fresh windows machine which does not have either VisualStudio and IIS installed in it;
Ways I analysed:
Using WebDev.WebServer, it can be done; Link
Question:
1) Does WebDev.WebServer gets installed along with a VisualStudio installation?
2) If not , please tell how can I install WebDev.WebServer as a standalone application in a windows machine,
Note:
Based on the answer in this discussion, I tried, but couldn't succeed. Reason is I couldn't find gacutil.exe in a fresh windows 8 machine which doesn't have VS / IIS installed in it.
WebDev.WebServer is kind of superseded by IIS Express now, which is documented, much more configurable, supports IIS extensions and other stuff. You can say it's pretty portable and does not require privileged account (for the most part).
Introduction blog post, IIS Express Readme
I'd suggest trying IIS Express instead of WebDev.WebServer.

How to run the c# exe application without having VS open

I am working with visual studio 2013 in c#. My application contains three project in the same folder: client side, database side and web service side.
When I run the application from within visual studio, it runs very well and all the features of the application are functioning. When I run the exe file located in the bin/debug folder, it runs only when VS is open. If VS is closed it runs only the client side and a message is shown
impossible to connect to the server.
How can I solve this?
When VS is open, it runs the server/web service, and your client. Running it from the commandline will require starting your server and web service side manually, and then starting the client.
If you don't have IIS manager installed you can launch IIS directly from iisexpress.exe.
It should be in C:\Program Files (x86)\IIS Express\iisexpress.exe, so just go ahead and run it.
Then you should be able to run your application.
To start IIS from the IIS manager go to Run (press Windows+R), and type in inetmgr.
This will open IIS manager, from there you can start it (forgive me for not being too specific, I don't have it currently installed. I believe you have a Start button at the side-panel. I hope someone in the comments could chime in or just edit this answer. If not I will install & update later).
After it is on you should be then able to run your executable successfully.
If your command-line can't find inetmgr, see my other answer here.
However if you do want to have the IIS manager you can install it + other IIS features easily:
Go to Computer → Uninstall or change a program.
At the side click on "Turn WIndows features on or off".
Inside "Internet Information Services" have your pick of whatever you want.
When you run in Visual Studio 2013, by default it uses its IIS Express as a webserver. You can set it to use IIS instead. (If you don't already have IIS installed, you'll need to install it using add/remove Windows components etc--google for more info on that if needed. Make sure you drill down to include ASP.NET under the IIS bits and pieces.)
To use IIS instead of the Visual Studio development webserver, right-click the project in Solution Explorer, and click the Web tab:
Select External Host in the dropdown, and enter a URL such as http://localhost/WebApp1. This is the virtual name by which IIS will access the files in your project folder. Earlier versions of Visual Studio included a button to create the virtual directory, but in 2013 you must create it yourself by running IIS Manager:
Enter the same virtual name you use in the project settings, and the physical path of your project:
Finally, right-click the newly created virtual directory and choose Convert to Application.
The website/webservice will now run under IIS, so will be available independently of Visual Studio.

Hosting an Asp.Net MVC 4 application on windows server 2012 with IIS8 from a Local Machine

I have developed an MVC 4 application on my personal laptop and would like to host it onto a windows 2012 server so that it goes live.
What I am doing right now is, I have published the application as a File System in my laptop and then remote logged in to the windows 2012 Server and trying to deploy it into IIS 8 which is on that server but I could find a way to import my application into the server.
Now, my question is do I need to install Visual Studio 2012 on the server and then copy my application over to it and then publish and deploy or is there any other way.
This is the first time I am deploying and hosting an application. So, I am not sure of the exact procedure to do it.
Remember that my development machine is not the windows server but it is my personal laptop.
Install WebDeploy (a free Microsoft Tool) on your target server. Then you can deploy your site directly from VS. See details here

Categories