otrdiena, 2014. gada 5. augusts

Windows 2012 and 32-bit ASP .NET v 2 application

I needed to migrate Windows Server 2003 Microsoft SQL 2005 ASP .NET 2 32-bit application to the Windows Server 2012 R2 with SQL Express 2014. Programmers was gone far long ago. Once you did it it is easy!

1. Prepare platform

You need not only to add features, you need to enable them.
ASP add feature
Magical command to get info about features status
dism /online /getFeatureinfo /featureName:iis-asp
I want to review a little "Add features" wizard in Control Panel. As you can see from the picture below, Microsoft don't know himself, is Web Server An application or not?
In "Web server" description there are written that web server is application, anyhow for me "Web Server" under "Application Server" must be checked. It more seems to me like inner rumor between MS departments.
ASP enable
It is not enough to install ASP it must be enabled
dism /online /enable-feature /featureName:iis-asp [/source] 
So it is not enough to install, you have to enable feature like ,"No I don't want to enable this feature, I  installed it just to be cool!" Source in DVD is "D:/Source/sxs" not just "D:/Source" Sometimes you can't install anything because you plugged in another DVD even when you put back Windows source DVD it can't find sources. So you have to provide sources in gpedit like "D:\source\sxs"

ASP register
After that you have to register proper version of ASP to run,
c:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe
It installs asp database. SQL server must be installed prior. Well why don't install asp database automatically if asp is not working without it? So you will have ASP enabled but it wont work anyway because you did not registered it.

2. Expansion of data

Expand sql server I needed to move database from SQL 2005 to SQL 2014 Express.
In descritions there are rumor that you can restore SQL 2005 backup on SQL 2012 in fact you can't. Only thing which worked for me was Script with parameters. On SQL Management studio Right click on database Choose "Tasks>Generate Scripts" Follow wizard and choose to "Schema and data", in SQL 2005 there was no option to add data, so you have to do it from SQL Express 2014 Management Studio.

Don't forget to change all necessary parameters to "True", like Collation, Schema etc.
I slighly modified script, it generates, first you need to change path to the database, seconfd you need to set compatibility level at least 100.
CREATE DATABASE [database1]
 CONTAINMENT = NONE
 ON  PRIMARY 
( NAME = N'database1', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA\database1.mdf' , SIZE = 23616KB , MAXSIZE = UNLIMITED, FILEGROWTH = 10%)
 LOG ON 
( NAME = N'database1', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\database1.ldf' , SIZE = 1964480KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
 COLLATE Latvian_CI_AS
GO
ALTER DATABASE [eprocess_em] SET COMPATIBILITY_LEVEL = 100
Notice that generated Log file is extremely big, you need to shrink it later. Don't leave first line "use master" because if it fails in next lines it will write all values in master database.
Execute file form command prompt because in Studio it will take too long.
sqlcmd -S localhost\sqlexpress -i C:\path to sql file\sqlfilename.sql

Web Deploy
You can just try to install web deploy on both servers and export-import application. http://www.microsoft.com/web/downloads/platform.aspx  So if anyone have success with iot, tell me about, I found more easy just to copy all to the new server.
Deploy script generates zipped web site.

Don't know why you can't deploy packaged site in IIS server you can deploy it only in site subfolder so it will look like http://localhost/yoursite not http://yoursite as in normal web servers so I just copied and recreated Web application pool manually.
Error message points out that can be installed only in subsite.

3. Permissions and configuration

By default Firewall allows incoming connections so you have to unblock Incoming.

Permissions for sql.
Click on "SQL server>Properties"


And at last what Microsoft guys smoke when they invent such management consoles?
As you see in Server Manager window you can open IIS which is not App but what IIS is then, if it is not App, Service huh? So it appears that IIS manager is tool of Server manager, it blows my mind every time I open it. Ok I agreed if it were called Server monitor not Server manager, because I just can notice that service is up and running, but not manage it. There are user called "ALL APPLICATION PACKAGES" maybe it workjs with .NET 4.5  for me it won't work so I returned to old known "Network Services" I pointed "Network Services" as Application account and vuala site magically started to work.
I have account Network Services which connects to folder with Network services credentials

Nav komentāru:

Ierakstīt komentāru