How do you publish an ASP.net MVC application from Visual Studio 2013 to your local network? - asp.net-mvc

I made a simple ASP.net MVC web application in Visual Studio 2013, and I want to deploy it so it can be accessed from the browser on other computers on my local network. I have tried right-clicking my project > Publish (not sure what settings to use, Web Deploy, Web deploy package, File system,
I published the website to my inetpub/wwwroot folder.
I managed to get IIS up an running, I've tried adding an application in the manager and editing the permissions to Everyone. I tried navigating to localhost/application_name but I was getting errors about not being configured to list the directory. I enabled directory browsing, but that just means it now shows a list of the files. How do I get it to actually run the app when I navigate to it in the browser?
Am I close?
Edit: currently trying this http://johan.driessen.se/posts/Accessing-an-IIS-Express-site-from-a-remote-computer (although this I think is a step or two ahead of where I am)
Also tried this: http://www.programmerfish.com/how-to-deploy-asp-net-web-application-on-the-network-in-windows-7/#.VGTLCvnF81L no luck so far

You can use IIS Express which comes with visual studio 2013. I've used this method to allow other members of the staff to access the website that is in my computer. Scott Hanselman has done a great post which I use every time when I want to expose a website hosted in local iis express to others in the same network.
http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx
If you have any queries, let me know. Hope this helps

When I want to use IIS Express within Visual Studio for development, but allow local network users to see a version of my site, I tend to create a publish profile in VS that publishes to the local file system (e.g. C:\Publish\<yourwebsite>). Then from IIS Manager create a new website pointed to that same folder and it should be accessible to you via http://localhost and to network users via http://<your-pc-name> or http://<your-local-ip>.
You will need to add an exception to Windows Firewall to permit HTTP requests (i.e. port 80) through to your local machine, but if you have configured IIS correctly they should see the website.
It is possible to make IIS Express available to remote clients but that's not what it's designed for so really you're better off going down the IIS route since this will allow you to test the configuration as it would be on a live/production setting at the same time.

Check this, and old version of the same question. I'd bet you need to install IIS locally
Use Visual Studio web server in local network

You need to enable IIS on the host as IIS Express is not built with that in mind. Its for debugging purposes.
You've also not mentioned your binding configurations or your app pool settings.
Here is a comprehensive tutorial on how to publish your application using IIS IIS Video tutorial
You will need to ensure the binding that you specify is available across the network and that the connecting clients have permissions.

The issue was that ASP.net was not registered with IIS
Opened command prompt as administrator
Navigated to C:\Windows\Microsoft.NET\Framework64\v4.0.30319
Ran aspnet_regiis -iru
Now web app runs in IIS http://www.asp.net/web-forms/overview/deployment/configuring-server-environments-for-web-deployment/configuring-a-web-server-for-web-deploy-publishing-%28remote-agent%29

Related

What is needed to open up an MVC project on a remote server?

I'm new to web development so please be kind. Anyway, I'm writing a web page in visual web developer 2012 and have hit a roadblock. I've got lots more experience with writing console applications. When writing one of those and you build the application, the bin folder is populated with the files that are required to run the application, most notable the .exe . But when I build the page all I get is .cshtml files, which when opened all it does is open the code in my web browser. I tried to get an answer on another web site but all that i got was "open it up on a web server". That doesn't make any sense to me. Please help.....
You open the project locally on your workstation, as you would any other project. But when you're ready to publish the project you would send it to a web server.
Visual Web Developer (being akin to Visual Studio, no?) should have a small built-in web server of some sort which it uses when you execute your project in debug mode. (There are more details than that, but that statement alone should be true enough to get you debugging.) That's fine for ongoing development work, but not for the resulting production application.
Analogous to installing a console application on a target workstation, you would need to publish your web application to a web server. This server may coincidentally by the same workstation on which you develop the code, but that's not a requirement.
A "web server" in this case can be one of many things. Your computer (running IIS, most likely), a server hosted somewhere, a service in the cloud, etc. And "publishing" could mean any number of things as well. Uploading the files, using built-in publishing tools in the IDE, even just committing the files to source control and allowing an automated publish service to fetch them (I do this a lot in Azure web sites).
Ultimately, the way you execute a web application that's been published isn't by double-clicking on a file anywhere. The .cshtml files, as well as any other needed files (binaries, config files, images, style sheets, etc.) are stored on a web server somewhere and you would "run" the application by making a request to that web server, which takes the form of browsing to a URL in your web browser.

Umbraco 7 in Azure cloud as web roles

I have been trying to get Umbraco working in a web role environment (web services) in Azure, but the site errors when you try and access it, saying that config/trees.config is not accessible.
These are the steps i carried out:
Create a new empty MVC4 project in Visual Studio 2013
Install Umbraco v7.1.8 from nuget
Run up and configure using a new azure SQL database.
Added in the umbraco folders to the solution.
Added an azure web services project to the solution.
Added the existing MVC umbraco project to the azure role profiles.
Published to Azure staging area.
The site starts up with the usual 'Looks like there is still work to do' screen in the full Azure emulator in visual studio with multiple role instances. However fails to run up when hosted in Azure.
I am currently assuming that the issue is that the site root does not have write access when hosted in Azure, so the IIS worker process cannot write to the trees.config file.
I found an article where you can add a 'startup.bat' file, with the following:
echo "starting startup task" >> log.txt
%windir%\system32\Icacls.exe .. \* /T /grant "Network Service":(F) > log.txt
But this stops the role instances for starting up at all in both the emulator and when hosting in azure.
Any suggestions would be gratefully appreciated
I would suggest using a VM instead of a web role for hosting Umbraco in Azure, particularly since Umbraco is needing local write access to persist.
Web roles expect your application to be stateless, meaning no writing or persisting anything to the actual file system. This guarantee allows Azure to make certain assumptions so that it can load balance and scale the application correctly (it basically saves a master copy and then re-deploys it fresh as it scales up or makes updates, etc. This works great for web apps that were created with this in mind, but if not, then a VMs allows you to scale UP without worrying about your app needing to work a certain way to properly scale OUT under a load balancer (which is what web roles are made to help you do).
So, basically I would suggest installing to a Virtual Machine. It's still in the cloud, and you get all the cloud benefits of on-demand scaling of the infrastructure. In addition, I would expect Virtual Machines to be a supported install of Umbraco, where a web role install would not. Hope that helps!

Unable to run Silverlight application from Visual Studio 2010

I'm in the process of setting up a new machine as a development environment and I'm having issues getting an existing code base that hosts a Silverlight application to work. The code runs fine on all other machines that my team uses.
Here is the error:
Error: Unhandled Error in Silverlight Application
Code: 2104
Category: InitializeError
Message: Could not download the Silverlight application. Check web server settings
I have had a Google around for some answers on this and I realize there is a duplicate question on StackOverflow already, but it does not provide enough information and the answers have not worked for me.
I am attempting to run the solution through Visual Studio 2010 Ultimate, using IIS Express 7.5 integration (as opposed to the Cassini web server). This approach works perfectly fine on all other machines, except for this one.
I have found that if I specify to use full IIS integration (instead of Express) and select the SilverlightTestPage.aspx as the start up page, then the application runs (although not perfectly). Also, if I publish the application and host it on IIS, it again works fine. However, when running through Cassini or IIS Express 7.5 integration, or when trying to get it to run through the Default.aspx or correct start up page it does not work.
Does anyone have any ideas what this might be? I've already checked that the MIME type in IIS is correct (not sure if I can do this in IIS Express as well?) and that the XAP files are building into the correct directory.
Check MIME types in IIS Express configuration file %userprofile%\documents\iisexpress\config\applicationhost.config and make sure that you have MIME types set correctly and restart IIS Express.
Please check the aspx file whether it has the "minRuntimeVersion" correctly for the Silverlight plug in.
<param name="minRuntimeVersion" value="4.0.50826.0"/>
also check the following link for hosting the Silverlight application .
Configuring IIS for silverlight

Unable to start debugging on the web server. The web server could not find the requested resource

I'm having this error trying to debug my ASP.NET MVC app. I've set the app to "Use Local IIS Web server", and selected ASP.NET as the debugger. Running the site without debugging works just fine, but when I try to debug, I got this error:
Unable to start debugging on the web server. The web server could not find the requested source.
I'm using Visual Web Developer 2008 Express Edition.
Does anyone know how to fix this error? Thank you.
For those encountering this with Visual-Studio 2012 and/or Windows 8 do the following.
You have to add .Net 3.5 (or 4.5) to your Turn Windows Features on or off window. You get to it via :
Control Panel -> Programs -> Turn Windows Features on or off
Click the Asp.Net 3.5 and the Asp.Net 4.5 check box in the IIS > WWW Service > Application Development Features folder.
Go to your web project's properties, then the "web" tab, then make sure that you're using the Visual Studio Development Server and not Local IIS or the custom webserver. I'm on VS2010 with Win7 and another developer was developing using a custom webserver URL and not the VS Dev Server
Sounds like you are trying to develop on IIS and not iis express or development server. If you are using asp.net mvc 4, make sure that the Application Pool is framework 4. If not just make sure that your app pool it matches your asp.net mvc version.
I had the same problem, and i fixed this way:
Go to IIS Manager -> Go to the site -> Error Pages -> Actions: edit feature settings.. -> Make sure you checked "detailed errors for local requests and custom error pages for remote requests".
IF you are using IIS6 and did the add mapping for .* in IIS trick to get MVC working, when you added the .* handler to iisapi.dll you forgot to uncheck the "check the file exists" check box.
Also, be sure that the URL you're configuring in Visual Studio matches your Host Headers (Edit Bindings) in IIS. This tripped me up for about an hour this morning before I realized my very stupid error.
Having maxRequestLength or maxAllowedContentLength set to a ridiculously large or small value will also trigger this error.
What i did, was just type the IP address in the web tab instead of "localhost"
This happened to me today. Turned out to be that the default website was stopped in iis. I had been working on a second website that didn't use it for a long time. Simple fix but took me a while to see it!
The root cause for this error can often be that the Windows Service W3SVC is not started. Check that this service in Windows Services console (services.msc) is started. In IIS you will now see the the Start icon is greyed out. This means that the W3SVC service is running.

Any tutorials about how to create an ASP.NET MVC 2 website and run it against Local IIS Web Server (not use Cassini)

does anyone have any good links/tutorials about how to create a simple ASP.NET MVC website, and have it run against a Local IIS7 Web Server, instead of the default Visual Studio Development Server (aka Cassini).
Yes, i tried google, but i fail at getting some good keywords, etc.
Cheers :)
Here are my steps:
In IIS, Sites -> Add Web Site...
Fill in the name, whatever you want.
Set the physical path where your app is located.
In the Host Name option, type for example local.test.com
Hit OK
Then I update the hosts file located in $windir$\System32\drivers\etc
Adding the line
127.0.0.1 local.test.com
Don´t forget changing in the application pool of the created website the framework version.
I´m sure there must be other ways, I just follow this steps every time I want to create a new site in my local IIS and it works.
Good luck!

Resources