After exploring Precompilation for Deployment topic I want to enhance my build process. Now, what I do is:
prepare web site using Web One Click Publish, for instance to c:\www\app directory, and that directory is available in IIS via app (localhost/app)
I launch aspnet_compiler.exe -v app c:\www\appprecompiled -f
Now I have ready precompiled application in c:\www\appprecompiled and everything is fine. However my application is quite big, and Publishing it (step 1) take about 5 minutes from scratch. So I wonder if it is possible to avoid step one , and perform step 2 (precompilation) with source folder pointing to solution folder. I tried something like this:
aspnet_compiler.exe -v codeapp c:\code\app -f
Where c:\code\app is the folder with web.config etc files, basically it's a project with web site and that folder is avaliable via http://localhost/codeapp.
But when launching that command, I get errors about missing global.asax or web.config errors:
C:\code\app\obj\debug\package\packagetmp\web.config(18):
error ASPCONFIG: 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.
And for the record, I use Application, not Virtual Directory.
So is there a way to perform precompilation on a plain web site folder?
I used
aspnet_compiler -p
physicalOrRelativePath -v / targetPath
from http://msdn.microsoft.com/en-us/library/ms227976(v=VS.80).aspx and removed obj folder prior to executing it, and precompilation works :)
Related
I want to delete the app_offline page(app_offline.htm) from the root of the IIS application when the work completed.How to automate this deploy and delete the app offline page in iis directory.
I tried read some artciles about MSdeploy but could not get that .
Can we do it by running some commands to auto deploy and delete the app_offline page from the server root directory ?
Please help me on this. I found below two commands to run
msdeploy.exe –verb:sync
-source:contentPath="[Project folder]\App_offline.template.htm"
-dest:contentPath="[IIS application path]/App_offline.htm",
computerName="[Destination web server]"
for delete
msdeploy.exe –verb:delete
-dest:contentPath="[IIS application path]/App_offline.htm",
computerName="[Destination web server]"
But not get how to run the above commands
You can also try use cmd.exe, It is located at C:\Windows\System32\cmd.exe, more information you can refer to this link: Web Deploy (MSDeploy).
Currently we have following structure:
web
build0001
build0002
build0003
So, each time we deploy new version of web application, we create folder with build number and then change path in IIS to use that directory.
Now question is, can I do same thing with msbuild:
1) publish to web\buildxxxx
2) and update IIS setting to use web\buildxxxx for that site.
While currently I doing all this in same server, in the future I'll need to do this on remote servers also, meaning that I'll running msbuild from different server than IIS is.
So far I've came to this:
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"^
-verb:sync^
-source:contentPath="c:\stageDir"^
-dest:contentPath="c:\web\build0004",computername="https://remoteServer:8172/MsDeploy.axd?site=MySite",UserName="DeployUser",Password="xxx",authType=Basic^
-enableRule:DoNotDeleteRule^
-allowUntrusted^
-postSync:runCommand="C:\windows\system32\inetsrv\appcmd.exe set vdir MySite/ -physicalPath:c:\web\build0004"
Problem with this approach is, that is requires a lot of permissions, because of these things:
build0004 at the moment of syncing is out of current website's folder (say build0003), so it requires DeployUser to have administrative rights.
I need ability to use runCommand, which requires even more - allow WMSVC to run commands.
I have an ASP.net that I built in VS2010 running in iis7 however when I go back into VS and make updates to the code behind file and re-publish the application still acts as it has before I made the changes. I have tried deleting and republishing all the files and restarting the app pool but it still doesn't affect how the application behaves.
project-->Property's--> Package / product web--> Items to deploy --> All files in this project folders
now publish your project.
your new files also added in publish folder. . .
DO NOT publish your vb and cs file on there server unless you feel like having your source code potentially exposed. There have been multiple vulnerabilities that have allowed code download.
Publish the application to a folder via the visual studio publish menu.
On the server, go into your temporary aspnet folder for example:
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
and find your app and delete it. If you cannot delete the files stop the worker process (w3wp.exe) or restart iis.
Republish and all should be good. If you are in doubt if that version is getting executed then add some logging in the new version or trace information.
There are two options for publishing an ASP.NET site to a server:
Copy the .aspx AND aspx.vb (or .aspx.cs) files to the server. The first user to hit the server causes compilation so it takes a little bit of extra time for them. Once that's done, subsequent hits should not be impacted.
Copy just the .aspx files - and a compiled DLL to the server. The DLL contains the compiled code so it doesn't exist on the webserver. The first user does not have to wait for compilation and the VB or C# source code is not on the server, potentially accessible to hackers.
It sounds like you've compiled the site to a DLL but that DLL isn't getting published to the server when you re-publish. Have you recompiled the site before publishing?
I faced similar issue with WPF single file exe publish.
while debugging from VS my changes were visible.
But when I pasted the exe to deployment folder, the changes weren't there.
I had to change the version number to see my changes when I run the exe from the deployment folder.
I may have to do with how single file exes are handled. The extracted cache may not be getting updated.
I have built a few custom applications that run on WSS 3 using the Visual Studio 2010 Web application template. When I compile the application, Visual Studio creates the assembly file in the bin directory which I copy over later to the production server (another machine) with WSS 3. The compiled application dll file is copied into the bin folder inside the virtual directory of WSS and runs fine in there.
As the project requirements / applications grew over time I now face the problem that the first hit on the assembly triggers dynamic compilation which I would like to avoid.
Even if applications are running fine I would like to use the asp precompiler on my development machine in order to reduce the delay when the page is first requested.
I have used the following command to precompile the entire Web Application:
aspnet_precompile -v / -p PATH_TO_WEB_APPLICATION C:\WebApp -errorstack
The compilation runs fine without any errors and I end up with a couple of .compiled files and also a Web_App_xxxxx.dll file inside the C:\WebApp\bin folder.
From here onwards I am a bit lost on how to proceed.
Could you please give me some advise to which folder I need to copy the compiled files on the production server ?
Do they need to go into the bin folder on the server or better into the folder where the aspx pages are located?
Additionally I would like to know if I can precompile the Web application on a development machine without the IIS metabase using the -v and -p switch and later use it inside WSS?
I copied all files from the C:\WebApp\bin folder to the server bin folder but unfortunately the csc compilation process still kicks in when looking with process monitor at the server events.
Cheers,
Mathias
The files just need to be dropped into the bin folder and everything will work fine. As for the -v switch you do need to have it if you're using the -p flag, but I think it depends how you're compiling the app too. Check this link out for more. I don't believe its a big deal if its wrong / incorrect though.
This kind of scenario sounds like a job for Cruise Control .NET environment.
I found an answer to this precompilation question:
I thought the first hit on the application page takes a long time because asp.net needs to compile it and I can save some time by precompiling. The application runs inside the WSS context and enables the user to go to a web form and update through the form his/her Active Directory profile. The Exchange global address list is also updated on the Exchange forest so the changes are visible through the Outlook address list and also on Communicator.
The complete solution code with reports etc is around 6000 lines of C# code.
My assumption regarding slow compilation due to the amount of lines was wrong.
I downloaded the following hotfix for asp.net:
http://support.microsoft.com/kb/961884
and set optimizeCompilations="true" in the web.config as explained here:
http://blogs.msdn.com/b/davidebb/archive/2009/04/15/a-new-flag-to-optimize-asp-net-compilation-behavior.aspx
http://www.paulliebrand.com/2009/09/18/sharepoint-development-to-bin-folder-and-extremely-slow-render-initial-render-times-solution/
Now the first hit on the application is much faster.
Many thanks,
Mathias
With web sites in VS2008 (the ones without .csproj files), a build does a kind of validation where the site is 'compiled' to nowhere, and web site dependencies are copied into the web site's Bin directory.
I want to do this exact process but at the command-line using msbuild. That is, I want an msbuild task that my msbuild target can execute that validates the web site, reporting any compile errors and copying dependencies to Bin, but does not require an IIS virtual directory, and does not precompile all the aspx and other files to DLLs in the Bin directory.
The AspNetCompiler task appears to do a full precompile, creating a directory full of compiled aspx pages. And it requires an IIS virtual directory. So I don't think this task will work for me.
How can this be done?
Have you checked VS Web Deployment Project . Also, take a look at aspnet_merge tool since you are concerned
The AspNetCompiler task appears to do
a full precompile, creating a
directory full of compiled aspx pages.
And I don't think aspnet_compile requires an IIS virtual directory