Sunday, November 10, 2013

MVC 3 and MVC 4 Razor Deployment Visual Studio 2012, Step By Step Tutorial [With SnapShot]

PreRequest:
1.       Add
<system.webServer>
     <modules runAllManagedModulesForAllRequests="true" />
In web.config.
Note: Inside<system.webserver> tag
2.       IIS should be installed properly

3.       Set local copy true for  following .dll in references.
 .
S    Microsoft.Web.Infrastructure
System.Web.Helpers
System.Web.Mvc
System.Web.Razor
System.Web.WebPages
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
Then Start Publishing:
Step: 1 Right Click ProjectàPublish.

Step 2: PublishàProfileàSelect <New..>

Step 3: ConnectionàWeb Deploy Package

Step 4: Be Sure you
1.it should be Web Deploy Package.
2. Package Location: Address should end with .zip
Choose the address location wherever you like to Save the zip file.
Any Location.

Step: 5
Setting: Configurationà Release, See the image.


Step 6:
Check the Location Address, You Need to Remember it
Than Click On Publish.
Step 7: You Would be Watching Screen as below image:
Step 8:Navigate to Address Location you Provided.
Step 9: there you will find  “yourapplicationname.deploy.readme.txt”  file.
if you try to execute .cmd file,  readme file pops up. Read  Prerequisites and  Required Flags.
As in below Picture
Step 10: Now if you don’t have msdeploy.exe not installed in your system.
You need to download and install from given link(http://go.microsoft.com/?linkid=9278654) in readme file.
During msdeploy.exe installation you need restart the system twice.
1st.  Middle of  ” msdeploy.exe” installation.
2nd.When the installation complete’s means after  1st time the system restart i.e when the “Web Platform Installer” installation complete.



Step 11: Now Start the Command prom tie cmd.exe from any where as you wish but RUN AS ADMINISTRATOR.
aa.       Run from Run Prompt.
Or
b.  Goto location. C:\Windows\System32 as below given fig.
Step 12: In command prompt navigate to Microsoft Web Deploy folder, default location (C:\ProgramFiles\iis\Microsoft Web Deploy). See the Image
Step 13: Move to the Address you Gave to Save the Rar File. While Publishing Step,
There you will find 5 file.
Navigate to this location on command prompt, look at command prompt screen,
My Path is C:\Program Files\IIS\Microsoft Web Deploy V3> H:\hg\DeployRealRAR\hg.deploy.cmd /t
Remember  to type  /t.


Step 14:
You will be looking at screen as image below:

Step 15:
If(NoError)
{
Than Step 16;
}
Else
{
If(Error About apppool Version)
{
We Need to Change the Version ;
Goto:  Step: Extra1;(Below At Last)
Than Again Start From Step:12;
}
else
{
Write the Error in the Comment Box below.
}
}

Step 16: At Step 14 we Added “/t” now you Need to Add “/y”


Step 17:
Will see the command promt as below.


Done.

Step : 18 open the iis manager.

Step: 20 YourName-PCàSitesàDefault Web Site.
If You find you Application here, it means everthing is going GOOD.
Step :20 Thats Ok, Now
Navigate to  wwwroot location.
Default location C:\inetpub\wwwroot.
Step :21
If you got your application folder at wwwroot location, make it rar file.

Step : 23 Make rar file as below.

Step :24 NOW UPLOAD THESE RAR FILE TO YOUR REMOTE HOST SERVER.

If Even though there exit Error:
Check You Asp.net Framework Version of your remote host.
And check the version you have mentioned it in web.config.
If both are different:
you have a option in your host control panel to change the version of Asp.net.
And this is it. Should work smoothly.  if it don’t work write a comment below, with snapshot of error.
//////////////////////////////////////Completed/////////////////////////////////////////////////////////
Note : Read following Step if you Got Error(apppool Version Error) in Step 16
Step : Extra1
Goto iis manager
Step: Extra2
YourComputerName-PCàSitesàdefaultàRight Click àBasic Setting

Step: Extra3
àSelect
Step: Extra4
Change DefaultAppPool to ASP.NET v4.0
Done. Restart your System.
/////////////////////////////////////////////////////////Enjoy////////////////////////////////////////////////////////////////