Use IIS as local web server to debug in my visual studio - asp.net-mvc

I've an asp.net MVC website which use somme DLL that work only in 32 bits or only in 64 bits(sql lite).
Since our server are running in 64 bits, I would like to run all my code in 64 bits. The problem is that the Visual studio development server is running in 32 bits in all case.
So I come to use a Local IIS Web server.
The problem is that with an asp.net MVC website, it's mandatory to have the website at the root of the URL.
So I wish to have something like "mywebsite.lo"(with a entry in my hosts file) or "localhost:9999" as project url.
But if I try to put this, when I create the virtual directory, I got this error:
Unable to create the virtual directory. Could not find the server 'mywebsite.lo' on the local machine. Creating a virtual directory is only supported on the local IIS server.
So I created myself the website with the correct binding responding to 'mywebsite.lo'. Now if I click on Create Virtual Directory, I got a successfull message. If But when I run the website, I got a message saying : Unable to start debugging on the web server. The web server is not configured correctly. See help for common configuration errors. Running the web page outside of the debugger may provide further information.

In order to debug in visual studio with a local IIS, then Visual Studio must be running as an administrator, are you doing that?

I made a dummy mistake: The application pool was in .Net 2.x :/

Related

Cannot upload asp.net mvc dll files to web server, 'File in use error'

I've revisited my asp.net mvc core 2.0 web site after some 8 months and for some reason I cannot upload any dll files from my local published folder to the hosting server. I keep getting the following error...
"Copying files to remote side failed.
The process cannot access the file because it is being used by another process."
I get this error no matter which method I use, ftp or http.
What's changed in the last 8 months?
Please check list below:
Please ensure you have rights to access the file;
Please check if the FTP port is used by other applications;
Please check if the file is indeed used by other programs.
Please run process explorer and see what process is locking the file.
Also try:
Restarting your visual studio
Restarting your operating system.
Restarting target server or Web Server.
Please provide more information for more help

Visual Studio 2017 - Giving remote users access to website in IIS Express

Been looking through and trying all guides i found on this topic but no luck. I am running and MVC project with HTTPS and want to access the debug site with some remote mobile devices to test out the website. I followed a guide that almost work and i think I am pretty close to getting it to work. Here are the steps I have done:
Turn off Firewall
Open projectfolder of website go to \vs\config\ and open applicationhost.config
Find your site and line that contains your mapped port like this:
-edit it to get this result:
Tried to run Visual Studio as Admin at this point, Got regular error 400: Bad Request - Invalid Hostname when trying to access site from other computer
Opened CMD as Admin and ran the following command:
netsh http add urlacl url=http://*:44363/ user=everyone
- URL reservation successfully added
-Tried to start Visual studio as admin and non admin. Gets the following error message
"Unable to launch the IIS Express Web Server.
Failed to reister URL "https://localhost:44363" for site "x" Application. Error description: Cannot create file when that file already exists"
-I then have to run cmd again and remove the url with the command:
netsh http delete urlacl url=http://*:44363/
How do i get this to work with Visual Studio 2017 ? I cant be many steps from getting it to work. I have read many guides but none of them works
Amazing how such a simple common need can be so painful to fulfill out of the box in 2017!
Anyway https://github.com/icflorescu/iisexpress-proxy worked nicely for me.
Install it with node:
npm install -g iisexpress-proxy
Then its just something like:
iisexpress-proxy 51123 to 3000
Under 2 mins to get running.
Let me share my experience with Visual Studio and IIS Express that should help you. I am not using HTTPS and my project type is Web site with WCF but you should be able to accomplish your goal.
Here are prerequisites:
IIS Express installed
Visual Studio installed
Added url reservation for public port (netsh http add url=http://*:50001/ User=Everyone) from elevated command prompt.
Added firewall inbound rule for 50001 TCP port (Control Panel-->Windows Firewall-->Advances Settings-->Inbound Rules-->New Rule...)
Now let us setup a project in VS. I am using one of predefined templates with C#. Compile it and try to run it from VS. At that moment VS is starting developer instance of IISExpress that helps your site to run.
You should be able to see IIS Express icon in Notification area. With right click you will see that your site is running and a port (we will call it VSPORT) that is assigned by VS. This port must be different than reserved port (50001).
If you managed to accomplish this without problems then you have almost everything ready for running your site without VS.
Go to your project folder
Go to .vs folder
Go to config folder
Open applicationhost.config
Locate sites/your_site section
Copy everything between your_site and /your_site
Now we need to add this info in "global" IIS Express config.
Go to IIS Express folder (something like c:\Users\USERNAME\Documents\IISExpress)
Go to config folder
Open applicationhost.config
Locate sites section.
Paste information about your site.
Change binding from
binding protocol="http" bindingInformation="*:VSPORT:localhost"
to
binding protocol="http" bindingInformation=":50001:"
Save changes
With this change you may start IISExpress.exe directly and you can continue to use VS to work on you project at the same time.
If you want to access it from other computers do it as http://YOURIP:50001/.
Do have in mind that you need to ensure that your javascript code is NOT using address and port number directly.
You can solve the problem by downloading the 'conveyor' library from extensions and update in Visual Studio.
You can access it from other devices.
Open Visual Studio
Tools > Extensions and Updates
Online > Visual Studio Marketplace
Search 'Conveyor'
Download and install this extension
When you launch the API, you can access it from other devices. This plugin creates a link from your own ip address.
Example:
https://youripadress:5000/api/values

How can I deploy an asp mvc app to a different computer using IIS

Is there a way to deploy my mvc web app to another computer (which will be used as a server).
Also, in the server, there is no Visual Studio installed, how can I deploy it there?
Check out those links below:
Access from another PC
Run project on another PC

How do I set the URL from localhost to localhost/applicationOne in Visual Studio?

I have a web application that at the moment is running on http://localhost if I use Visual Studio to run the solution.
I would like to change the settings so that VS starts running it on http://localhost/applicationOne as the starting point.
I want to replicate an issue that seems to be happening only if the web application is deployed to a directory that is not of the root directory in an IIS server.
How do I go about doing this?
You can edit the properties of the project, and set the Project Url.
If using Local IIS
Note: this will require Visual Studio to be run as an Administrator. Behind the scenes, a virtual directory will be created in IIS, and launching the project (e.g. via debugging with F5) will launch the browser, using the Url specified here.
If using IIS Express
Effectively the same settings apply with IIS Express. Note the port number in the Url.

Can't make WebAPI application work on windows 2008 server

I'm new to Web API Applications. I created my very first application with only one simple Controller with only one Get() method that returns a List.
In my PC it works fine. Even after I publish the solution and access it via my IIS 7.5, the results are ok: I access
http://localhost/Application/api/Controller
and I get the answer I expect.
So I moved forward to the next step: deploying it to another server so other people in my office can access it. The server we use runs a Windows 2008 server. What I did was to simply copy the Publish folder generated by the publish command in Visual Studio 2012, and paste it in the inetpub\wwwroot folder in the server computer. Then, I accessed the IIS 7.5 that's running on the server and created a new application using the .NET 4.0 Application Pool, using the Publish folder as its physical path (exact same steps I did in my PC to publish it to my IIS).
The problem: when I try to access the application in the server machine (that's running windows 2008 server), I get the 404 error. It seems like it tries to find a physical path Application\api\Controller, insted of resolving it logically like my machine does.
I did try all the different solutions I found in the web:
I did enable all verbs in the ExtensionlessUrl-Integrated-4.0 under the mappings configuration for the Application in the IIS.
I did add the WebApiConfig.Register(GlobalConfiguration.Configuration); in my global asax.
What I noticed is that my machine has the .NET Framework 4.5 installed and the server machine only has the 4.0 framework (client and extended). But I get the same error even after compiling the application targetting the 4.0 framework.
The only MVC .dll I have in my bin directory is the System.Web.Mvc.dll... do I need any other DLL?
Thanks in advance.
Try this:
<system.webServer>
.....
<modules runAllManagedModulesForAllRequests="true" />
.....
</system.webServer>

Resources