Questions about copy IIS config files to another server - asp.net

I have several asp.net web services is running in IIS. Now I want to move to another server in all exactly same IIS setting and using same web services. I know about copying a IIS config files(ApplicationHost & administration) to new server remotely but do I also need to copy all asp.net files to new server as well? If yes then must the asp.net files be in the same file path directory as the current one(D:\Website) for IIS in new server to be able to recognize it?

Yes, you would need to copy the ASP.NET files as well.
It is not necessary to put them in the same file path directory. Whatever directory you put them in, ensure your IIS Website Settings point to that directory and you have setup the same set of permissions etc. on it.
e.g. You could have had a website on c:\site on one web server. you could move the website files onto another web server and put them on d:\newsite\ and change the Website Directory Path in IIS Manager to point to D:\newsite\ directory.

Related

How to create 2 asp.net web form applications in the same website each in different subfolder?

I'm creating multiple small ASP.Net Web forms applications i want on my host each project of those to run in different subfolders for the root directory of my host. When i puplish each project to different subfolders of the root directory all of them dont work. The only one that works is the one at the root directory. I think this issue is related to Web.Config. I want to ask is there a way to run each application of those in different subfolder without creating other websites ??
IIS
I have been doing this a lot for testing purpose before final deploy. I just host the new application in the virtual directory of the the existing website that we own.
for eg:- www.example.com is our site
and we have a application named xyz then url for new application will be : www.example.com/xyz
You have to add a virtual directory in the root of the IIS website and turn it into an application by right-clicking on it in the IIS management console.
Or simply you can put the website in your root website (as in your case) and then in the IIS management console convert that folder to application.
Create and Configure Virtual Directories
Setting Virtual Directories as Applications in IIS

Deploying WCF webservice to IIS

I'm trying to deploy a wcf web service to IIS 7.5. Is there anything special I need to do in order to make this work. I keep getting 404 error when I try and run the web service. I can't seem to pull up the wsdl file either.
These are the steps I've taken
Right-clicked on web service project and published to local folder
Copied contents of publish to IIS server
Setup a new website that points to folder with webservice files
set binding to match web.config binding (port #)
Is there anything I missed or overlooked. Shouldn't I be able to run that web service from IIS and load up the wsdl file directly on the server. When I test in visual studio, it handles the loading of that host program.
Apparently you have to load the .svc file path which I was not doing.
Just to expand on this a little, since this question got me started but there were a couple of extra steps I had to take:
In VS2012 right click on the web service project and select Publish
Publish to file system by selecting a directory to publish to
Copy the folder contents into a folder on the server
In IIS create a new website, its physical path being where you just copied the published contents to.
Set its app pool appropriately (probably .NET 4.0)
The binding port should be the same as in the web.config as should the name. So if you've been working locally and your web.config reads "http://localhost:12345/MyService" then hostname is "localhost" and the port is 12345
You can then browse to the webservice by right clicking on the website in IIS -> Manage Website -> Browse. Click on your service name.

The requested page cannot be accessed because the related configuration data for the page is invalid

I am getting this error when I try to run an ASP.NET application without a web.config file.
The requested page cannot be accessed because the related configuration data for the page is invalid
as I read, we can run .NET applications without web config files, but when I tried it is giving me the error. I am using iis 7 on windows 7 machine.
When I create the application virtual directory inside inetpub/wwwroot it works fine. Why doesn't the other directory location?
One reason could be the version of .NET framework (on IIS or application pool level) is different from the application one.
Another reason could be if there are modules used in your web.config which the current configuration of IIS doesn't recognize. E.g. URL rewrite or other optional modules, which you have to explicitly enable before using.
This can be a reason:
If there is no Web.config file in the
UNC directory, IIS 7.0 uses the rules
that are defined for the parent
directory. For the Web content to be
served in this scenario, the
worker-process identity must have
access to the whole content directory.
Otherwise, the Web request is
rejected.
Details here.
You need to set permission for your Website folder or copy them to wwwroot folder.
If you choose to set permission, there are two ways:
Right click on Your Website folder, or
Right click to Your Website in IIS
Then select Edit permission and Add a permission (IUSR - default iis user)

Setup IIS 6 to only server static files from virtual directories

We're having the same setup and receiving the same problem as:
IIS 6 with wildcard mapping and UNC virtual directory problem
Setup
Server 2003 32bit, IIS 6
ASP.NET wild card mapping
A virtual directory mapped to an UNC share serving static images for a CMS in a load balancing environment
My question if it's possible to turn off asp.net from virtual and only serve static files e.g. images in the virtual directory, to avoid the problem with too many open connections?
If it's not possible I'll guess I have to implement a solution like Version control of uploaded images to file system to server the files from a local disc.
I found a possible solution at http://blog.stevensanderson.com/2008/07/07/overriding-iis6-wildcard-maps-on-individual-directories/ that removes the wild card mapping and makes it possible to turn of execution of asp.net files.
There is not a way to remove .NET from a subdirectory as it is part of an application at this point (your root directory). However, this method works just fine for keeping .NET from processing your static content.
From your site that you linked:
Alternative
If you don’t like to use adsutil.vbs, you can achieve the same by exploiting what appears to be a bug in IIS Manager. Turn your subdirectory into an application (from its Directory tab, click “Create”). Then edit its script mappings to remove aspnet_isapi.dll. Then go back and “Remove” the application you just created. The metabase’s new ScriptMaps value will be retained, even though the option has now disappeared from the GUI.

why it is still necessary to create virtual directory in IIS when website content is placed in IIS root directory

As virutal directory points to physical path of the application, so if the IIS root directory is C:\inetpub\wwwroot and the application is stored at D:\websites, than we need to create a virtual directory but if the application content is placed at C:\inetpub\wwwroot, then why still need to create virtual directory.
Actually you don't need to create a virtual directory. What you need to do is define it as an application folder, adding a virtual directory does this by default so that's why it works. All you really need to do is right click the folder under your website, click properties and under the Application Settings section click create. Your folder will then have a gear icon off to the side denoting it as an application folder.
As to why application folders are necessary, I believe it's a way of forcing you to choose which Application Pool you want the application running in rather than having every sub directory application running off the same pool by default.
IIS isn't used just for ASP.Net, it can serve up PHP for example...so the type of application and pool varies, it's not automatically created and tied to then ASP.Net engine.
If you can clarify a bit more what you're trying to do maybe we can help further. For example, if you want to point the root application to another folder and it be an application or create another website, IIS allows you to do any of that...you just need to update the question with which version of IIS, as the instructions very between them.
If the IIS site will host a single ASP.NET application you can place it at the root (C:\inetpub\wwwroot) and you don't need to create a virtual directory because when you create the site it is already a virtual directory.

Resources