I have a ASP.NET MVC4 application, running with VS2010. I am publishing using the "Build > Publish" command and accessing it through my LAN.
This works OK and the website loads. However, whenever the website tries to call directories stored on my local drive, it cannot find them. So if it tries to open the absolute path:
C:\myFolder\
..it says it does not exist when accessed via LAN, even though it works OK when I run it locally. I tried adding that folder to the VS2010 project and republishing, with the path set "\myFolder\", but the proble persists, getting error code:
directory 'c:\windows\system32\inetsrv\myFolder\' does not exist
Maybe you should use relative paths and deploy these within the website folder ? (using App_Data if needed)
How can you be sure the C:\ drive will be available on the server with the corrects files ?
Related
I've been making some changes to my MVC project which earlier today was running fine. However, I installed some new software including PostGreSql and npgsql for Visual Studio and now when I run my project it seems IIS can no longer find localhost. The actual message is 'Cannot reach this page. Make sure the web address http://localhost:4068 is correct'.
I've checked that my IIS is running and I've tried deleting my IISExpress folder, deleting the config file in .vs/config but so far nothing seems to work and I don't even know what it was that caused it. If anyone has had this issue, please let me know how you resolved it.
The most likely scenario is that your project's properties have changed.
Have you checked the web settings? (right click on project -> properties)
You need to put an entry in your c:\Windows\System32\Drivers\etc\hosts File like
127.0.0.1 localhost
Or simply try http://127.0.0.1:4068 as url
Editing the file needs administrative rights so you might run your editor as administrator.
I have an ASP.net MVC 5 aplication with VS2017.
I would like to load some pictures from a network path (the pictures should not be included to the project folder structure).
I know how to add a virtual directory in IIS on my server where the application is finally running. But I dont know how to setup the same on my local computer.
On the server I can setup an Alias and a physical path.
But in my project in VS2017(properties/web) I can only press the button "create virtual directory" next to project url "http://localhost:51138/".
Can maybe someone explain how to setup an virtual directory on localhost for testing? Thank you so much.
You are using the Visual Studio Development Server which does not allow virtual directories. You can do what you want with a local copy of IIS, creating a website that points to your development folder, and creating the virtual directory you want in that website.
Install a local copy of IIS. This is available to you in the
Professional version of Windows.
Open IIS Manager, create a new website, and set the Physical
Path to your development folder.
Add a binding for this website with the Host name set to a domain name you want to use for
testing. I generally use ".loc" as the TLD. For example, the
production website domain of "mywebservice.com" would be
"mywebservice.loc". Use port 80 in the binding.
Modify your local hosts file at
C:\Windows\System32\drivers\etc\hosts to include this line. Replace
"mywebservice.loc" with whatever domain you chose to use above mywebservice.loc 127.0.0.1
In your VS project properties, set Web-->Servers to Use Custom Web Server and
set the Server Url to mywebservice.loc or whatever domain you chose above.
Now you can add a virtual directory just as you do in production.
I do this for all my website development primarily because nothing will happen in production that does not happen locally. You can even test using real SSL certificates this way.
Just create a folder in the directory of your project to mimic what will be a virtual directory and then copy some test files there.
For example, create a documents directory in your project directory. So the referenced path in your project will be something like ~/documents/somefile.pdf
The server's virtual directory documents can then point to some some other network location.
When I execute my .NET MVC website from within visual studio, the url points to
http://localhost:61453/ (I have set this port number).
Now I need to publish this to a different local server, whose IP is 172.21.1.83, so that users can access the website by typing www.mysite.com as the URL.
The site needs to be deployed on IIS 7. How do I achieve this? I tried using the 'Publish' option, but it asks me to enter Server, Site name and destination url. So as far as I understand, I should be entering these:
Server: 172.81.21.83
SItename: www.mysite.com
site url: The director where my deployment artefact will be located.
Is this correct? Also, once I create the deployment artefact, do I just open up IIS manager and follow the prompts to host it?
I tried some online steps regarding this, but I am unable to figure it out.
Open IIS manager on IIS server -> expand your server -> right click sites -> select Add website. Choose your host name, port, application pool and select directory of source files(Content directory - Physical path). Then you can click publish in visual studio. Choose filesystem as publish method and publish your project to local drive. Then just copy content of published folder on your drive to folder you have selected when creating IIS site(directory of source files mentioned here).
There are other options how to get your site from VS to IIS. You can send files directly via FTP My favourite is web deploy, where you create config file on IIS, load it to your project in VS and just click publish.
I have a hosting running windows, lets say the root domain is xxx.com. On xxx.com there should be website running on php (since IIS can run PHP, right?) or asp.net. I really dont know yet.
I am now responsible of making a asp.net mvc app, which should be running only inside a folder like xxx.com/myaspapp.
I've tried to publish the app straight to the folder via visual studio and it fails with an error:
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.
Parser Error Message: It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This error
can be caused by a virtual directory not being configured as an application in IIS.
What is a solution for this? Is this scenario even possible?
Thank you.
WebDeploy can create a virtual application under an IIS site automatically. Check it out:
THE ANATOMY OF A WEBDEPLOY PACKAGE
It is simple to host an application in a sub folder. Follow the below steps.
Create a folder (myaspapp) under the root site path.
Open IIS Manager (inetmgr) and expand till the new folder.
Right the newly created folder and click on Convert to Application.
Deploy/Upload the application files directly to this folder.
Now you will be able to access the site from the sub folder.
Is it possible to run ASP.NET application in a subfolder of localhost ? E.g. "localhost:61778/subfolder/" instead of "localhost:61778/"?
I will publish my web application into sub-folder on real host like "www.mysite.com/subfolder/". I want to test that all patches will be builds correctly and sub-folder will be used (I need to save and restore some files).
Another question is How to get website directory with a sub-folder like "www.mysite.com/subfolder/" where a website is deployed?
You can install IIS on your local machine and create an application over IIS (localhost/ApplicationName).