I tried to include a Task as per MSDN article below:
http://msdn.microsoft.com/en-us/library/windowsazure/jj154098.aspx
However I'm getting the error below on one of the instance;
Recycling (Waiting for role to start... Application startup task failed with exit code 1. [2013-04-13T11:03:22Z])
Could someone please suggest what's really happening and what's the fix if any?
Below is my cmd:
#echo off
#echo Installing "IPv4 Address and Domain Restrictions" feature
%windir%\System32\ServerManagerCmd.exe -install Web-IP-Security
#echo Unlocking configuration for "IPv4 Address and Domain Restrictions" feature
%windir%\system32\inetsrv\AppCmd.exe unlock config -section:system.webServer/security
And CSDF:
<Startup>
<Task commandLine="Startup.cmd" executionContext="elevated"/>
<Task commandLine="startup\startup.cmd" executionContext="elevated"/>
</Startup>
Thank you
I had a similar problem once. I fixed it by adding the following to my start-up script:
exit /b 0
Without this the Azure Fabric didn't register the script as finished and it kept recycling the instance.
I see you use ServerManagerCmd.exe. This command is removed from Windows Server 2012. So make sure your role isn't deployed with the latest OS Family version.
<ServiceConfiguration ... osFamily="1" ...>
What you can do here is RDP into the instance and run the .CMD file manually to see if it's throwing any errors.
I received a similar error when deploying to Azure and it was caused by the startup command raising a dialogue box that required a user input. Essentially the alert box was confirming that a .dll had been registered, that's all, but it was enough to stop the deployment routine in it's tracks.
Here is the contents of my .cmd file:
chcp 1252>NUL
regsvr32 /s .\library\asppdf64.dll
regsvr32 /s .\library\aspjpeg64.dll
exit /b 0
The /s tells the service to run silently (i.e. with dialogues purged). The chcp 1252>NUL sets the code-page.
Related
I get the following error when tring to run dotnet publish:
The process cannot access the file because it is being used by another
process.
This appears to happen when you try to publish your app and you have been viewing the published version in the browser, for some reason it locks out the files.
Full error message:
C:\Program Files\dotnet\sdk\2.2.301\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(169,5): warning MSB3026: Could not copy "obj\Debug\netcoreapp2.2\TemplateWebApp.dll" to "bin\Debug\netcoreapp2.2\publish\TemplateWebApp.dll". Beginning retry 1 in 1000ms. The process cannot access the file '\cpft-bi-web01\d$\Websites\TemplateWebApp\bin\Debug\netcoreapp2.2\publish\TemplateWebApp.dll' because it is being used by another process. [\cpft-bi-web01\d$\Websites\TemplateWebApp\TemplateWebApp.csproj]
I can resolve this by closing the browser and the restarting the website on IIS Manager but this is really not ideal, does anyone know the cause of this?
To solve it, i recycle the apppool.
On local environment, i have a Post Build Event Project -> Properties -> Build Events -> Post-build event command line, that runs a .bat file that sits in project directory.
This is the code from bat file:
%SYSTEMROOT%\System32\inetsrv\appcmd recycle apppool /apppool.name:"YOUR APP POOL NAME"
dotnet publish --force --no-build
pause
Just make sure you replace YOUR APP POOL NAME with your actual pool name (and keep the double quotes)
So every time i build the solution, it recycles the pool and publishes the app. Because i just build the app (right before publishing), i specify --no-build to publish command.
I had the same error. Stopping the application pool on IIS, then publishing, then starting the pool again worked for me.
I use pretty much standard custom kudu deployment script for asp.net core web app for external git deployment.
I managed to run the script mostly successfully, through mingling with SCM_COMMAND_IDLE_TIMEOUT and .cmd files encoding. My deployment scripts look as follows:
.deployment
[config]
command = deploy.cmd
deploy.cmd
#echo off
IF "%WEBSITE_SITE_TYPE%" == "<project_name>" (
.\<project folder>\Properties\deploy.cmd
goto end
)
echo Unknown WEBSITE_SITE_TYPE: "%WEBSITE_SITE_TYPE%". Expected one of the "<project name>"
:end
exit /b
.\<project folder>\Properties\deploy.cmd - regular asp.net core deploy.cmd script, updated for proper folder structure.
The WEBSITE_SITE_TYPE is a custom environment variable I added to the web app.
All these scripts saved with utf-8 without BOM encoding.
But even though the scripts look like runs successfully, the final state of the deployment process is Failed.
When looking into the kudu deployment log last few lines of the log look as follows:
...
2018-10-14T20:50:51.0660695Z,Copying file: 'wwwroot\runtime.ec2944dd8b20ec099bf3.js',,0
2018-10-14T20:50:51.0660695Z,Copying file: 'wwwroot\styles.8ef9ef86d2a54ed3748c.css',,0
2018-10-14T20:50:51.0816988Z,Deleting app_offline.htm,,0
2018-10-14T20:50:51.0816988Z,Finished successfully.,,0
2018-10-14T20:50:51.1129431Z,\r\nD:\Program Files (x86)\SiteExtensions\Kudu\78.11002.3584\bin\Scripts\starter.cmd deploy.cmd,,2
Apparently the last line returns error code 2 and it might cause the script status to fail. But what does it mean and how do I fix it?
I was learning how to use the Microsoft Azure Tools for Visual Studio to develop an Azure cloud service at :"Getting Started with the Azure Tools for Visual Studio".
I successfully completed the following steps:
1. Install the Azure tools.
2. Create an Azure cloud service.
3rd step was build and debug the cloud service, where i was stuck.
While debugging i got an error "Failed to initialize Microsoft Azure Storage Emulator".
I did try various methods given on various websites to initialize the Storage Emulator, but none of them worked for me.
When I was trying the command WAStorageEmulator.exe init , i got an error "cannot create database".
Any help would be greatly appreciated.
Step 1 : Start your system in safe mode (Immediately after the computer is powered on or restarted tap the F8 key to enter safe mode).
Step 2 : In safe mode go the path C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator.
Step 3 : Search for WAStorageEmulator.exe - config file.
Step 4 : Edit WAStorageEmulator.exe with Notepad++ (any editor).
Step 5 : Change the port numbers as shown in the above snapshot.
(By default the port numbers will be 10000, 10001, 10002).
<services>
<service name="Blob" url="http://127.0.0.1:30000/"/>
<service name="Queue" url="http://127.0.0.1:30001/"/>
<service name="Table" url="http://127.0.0.1:30002/"/>
</services>
Step 6 : Save the file and restart your system in normal mode and run the program.
I hope this helps.
I had a similar problem and it sounds like one of the answers posted here:
This post talks about removing old mdf files so you can install again
This seems to be closer to what you are experiencing.
I hope this helps
Open MS Azure Command Prompt. Type (depending on your local db name):
SqlLocalDb stop projectv12
SqlLocalDb delete projectv12
Then go to
C:\Users(admin)\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances
and I deleted all instance in there. Then try re-install the Azure storage emulator. This worked for me.
A re-boot is not neccesary as per the accepted answer.
Open a Powershell window in admin mode.
Enter the following command: netstat -p tcp -ano | findstr :10000
That will tell you what process id is using the emulator designated port.
Use the Detail Tab in Task Manager detail to find the associated application for the process id. Often times this is something like bittorrent/utorrent.
Kill that process and you're done.
..
But if you absolutely must run the conflicting application while you develop then you can change the ports used by the emulator.
To change the ports used by the emulator, then in powershell:
chdir "C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator"
.\WAStorageEmulator stop
Then edit the config file as per the accepted answer and just save it.
C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\WAStorageEmulator.exe.config
You don't need to copy it anywhere. Then back into Powershell and :
.\WAStorageEmulator status
.\WAStorageEmulator start
Make sure you have SQL Server Express or SQL LocalDb installed. You should then be able to type
.\AzureStorageEmulator.exe init
Or, in this older case:
.\WAStorageEmulator.exe init
...and it should install the default database. Note I'm using the PowerShell syntax. If using the command prompt, it's minus the .\ portion.
It's not always a port conflict, contrary to what other posts may suggest.
You can download SQL Server Express editions here:
https://www.microsoft.com/en-us/sql-server/sql-server-editions-express
You should see something like this when you run the command:
PS C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator> .\AzureStorageEmulator.exe init
Windows Azure Storage Emulator 5.10.0.0 command line tool
Empty SQL Instance. Autodetecting SQL Instance to use.
Looking for a LocalDB Installation.
Probing SQL Instance: '(localdb)\MSSQLLocalDB'.
Caught exception while probing for SQL endpoint. Login failed for user 'somedomain\someguy'.
Number of SqlErrors Reported: 1
SqlError: System.Data.SqlClient.SqlError: Login failed for user 'somedomain\someguy'.
Could not find a LocalDB Installation.
Probing SQL Instance: 'localhost\SQLExpress'.
Found SQL Instance localhost\SQLExpress.
Creating database AzureStorageEmulatorDb510 on SQL instance 'localhost\SQLExpress'.
Granting database access to user somedomain\someguy.
Database access for user somedomain\someguy was granted.
Initialization successful. The storage emulator is now ready for use.
The storage emulator was successfully initialized and is ready to use.
PS C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>
The problem is with the “(localdb)\MSSQLLocalDB” SQL Service with Permissions.
The best option is using below commands,
Step 1: Go the path “C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator”
Step 2: Open PowerShell as Administrator,
Step 3: Run the below command in PowerShell,
“AzureStorageEmulator.exe init -server . -sqlinstance SQLEXPRESS -forcecreate”
Below is the output,
Step 4: Run the below command in PowerShell to Start Emulator,
“AzureStorageEmulator.exe start”
Below is the output,
Step 5: After that check the “SQLEXPRESS” Databases,
New Database is created.
Now you can use the Storage Emulator.
We have started migrating our one of several projects to team city as part of CI. Below is how we have setup teamcity build. We are trying to deploy WebSite.
1) Build Step 1 (Package installation)
Using "command line " runner type install required package.
2) Build Step 2 (Build)
Using Runner type "Visual Studio (sln)" (Visual Studio 2010) build website.
3) Build Step 3 (Deploy Web Site)
Using ".Net Process Runner", deployer.exe (x86 built with .Net Framework 4) deploy site.
Deployer.exe reads config file. Config file contains "BuildId", "Environment" and "Servers" where we want build to be pushed.
<buildType id="bt52">
<env name="Debug">
<server path="SERVER1" />
</env>
<env name="QA">
<server path="SERVER2" />
<server path="SERVER3" />
</env>
<env name="UAT">
<server path="SERVER4" />
<server path="SERVER5" />
</env>
</buildType>
Deployer.exe is called with required parameters as below. Which reads config and deploys site to Server2 and Server3.
Deployer.exe "bt52" "QA" "siteQA" "E:\BuildAgent\work\2483052e33e5e1e8\src\diy\" msdeploy.exe
Problem area is step #3.
When we run deployer.exe using .Net process runner as part of team city we see its hanging and not responsind sometime even for 45 minutes. When we try to execute same deployer.exe from build server using command line script executes within couple of seconds.
E:\TeamCity_custom_applications\deployer>Deployer.exe farm1-1 QA siteQA E:\BuildAgent\work\2483052e33e5e1e8\src\diy\ msdeploy.exe
Info
: Processing batch run ... Info : Processing command ...msdeploy.exe
-verb:sync -source:contentPath="E:\BuildAgent\work\2483052e33e5e1e8\src\diy\" -dest:contentPath="siteQA",wmsvc="SERVER2",userName="*****",password="******",authType="Basic"-skip:objectName=filePath,absolutePath=web.config -skip:objectName=dirPath,absolutePath="bin" -enableRule:DoNotDeleteRule -allowUntrusted Info : output >>Total changes: 0 (0 added, 0 deleted, 0 updated, 0 parameters changed, 0
bytes copied) Info : error >>(none) Info : ExitCode >> 0 Info :
Processing command ...msdeploy.exe -verb:sync
-source:contentPath="E:\BuildAgent\work\2483052e33e5e1e8\src\diy\" -dest:contentPath="siteQA",wmsvc="SERVER3",userName="******",password="******",authType="Basic"
-skip:objectName=filePath,absolutePath=web.config -skip:objectName=dirPath,absolutePath="bin" -enableRule:DoNotDeleteRule -allowUntrusted Info : output >>Total changes: 0 (0 added, 0 deleted, 0 updated, 0 parameters ch anged, 0
bytes copied) Info : error >>(none) Info : ExitCode >> 0
Info: Deploy Script Complete.
One more thing we observed is running deployer.exe through teamcity I see that site content gets copied but only for 1 server and teamcity build status stays in "Running" mode. I am wondering if someone can please put little bit of insight on how can I look into this issue.
Update 1:
Thanks for your time looking into it !! What we ended up doing is, Instead of running command "msdeploy.exe" from "cmd.exe" we added "msdeploy.exe" location as Environment variable and executed "msdeploy.exe" in loop for # of servers. This has resolved issue of hanging. Now I am just curious to know why would it behave in such manner where if you execute "msdeploy.exe" from "cmd.exe" it would hang while running directly "msdeploy.exe" it would execute successfully. Any insight into same would be greatly appreciated.
Update 2:
I have added image which explains behavior using process explorer. If we kill msdeploy.exe from process explorer than for next all deployments to that server will not have the issue of build hanging. Please see below image
To be honest, it sounds like you're running into issues with redirecting input/output streams. TeamCity is running your application in a totally headless environment and then you, in turn, are attempting to redirect and parse the output of msdeploy.exe
If that's the case, I'd recommend looking into using the MSDeploy API instead of msdeploy.exe. The latter is just a command line wrapper for the former, so all the functionality is available to you. There's a sample deployment application available on the IIS blog if you need help getting started.
It seems you have NUnit build step configured in TeamCity and invoke cmd.exe from your test. This looks like an issue with the test code then. Most probably it will reproduce without TeamCity if you run the test in question with NUnit directly.
As Richard noted, most probably the issue root cause is related to stdin/stdout processing.
If you want to fix it in your code, you can try to experiment by explicitly closing stdin or the other way around, try writing something into it, etc.
Work around we did is, we observed msdeploy doesn't take more than 3-5 seconds to execute and deploy (Even for our biggest project which is almost 300mb website). So we set timeout of 20 seconds. So far since last 1 weeks we have not seen any issue with it and hopefully it will not cause more trouble but still we are not sure why such behavior.
I have a web role that I'm trying to run locally using the emulator. I have it working on another computer, but I cannot get it working on a different one, and have gone as far as to reformat it and start from scratch.
When I launch the site from Visual Studio, Chrome shows the following message:
This webpage is not available
The connection to 127.0.0.1 was interrupted.
There is also an error code listed at the bottom:
Error 101 (net::ERR_CONNECTION_RESET): The connection was reset.
One interesting thing from the build output are these lines:
Starting process 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Windows Azure Tools\v1.8\Debugger\WindowsAzureDebugger.exe' with arguments '"C:\Program Files\IIS Express\iisexpress.exe" /trace:error /config:"C:\Users\brian\AppData\Local\dftmp\Resources\159c7254-b7d0-4076-a4fd-820b00feca5f\temp\temp\RoleTemp\applicationHost.config" /site:"deployment18(27).AzureApp.MyApp.Web_IN_0_Web"'...
Process 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Windows Azure Tools\v1.8\Debugger\WindowsAzureDebugger.exe' exited with exit code 0.
If I run C:\Program Files\IIS Express\iisexpress.exe" /trace:error /config:"C:\Users\brian\AppData\Local\dftmp\Resources\159c7254-b7d0-4076-a4fd-820b00feca5f\temp\temp\RoleTemp\applicationHost.config" /site:"deployment18(27).AzureApp.MyApp.Web_IN_0_Web" from the command line, I get the following message:
The system cannot find the file specified.
Unable to start IIS Express in background.
I have no idea what file it cannot find, but I've verified that the config file I'm passing does in fact exist. Anyone have a clue what's going on here??
While I can not tell you what could be the actual root cause of your problem I can suggest a few ways to troubleshoot it:
Try changing IIS Express to Full IIS and see if it changes the behavior. You can do it by going to your Windows Azure Application project properties and look at "Web" option.
Try running application without debugging it
Launch CSrun at command prompt with /launchDebugger parameter of the /run option to verify that debugger does run without any issue
Try using IE as default browser
Clean your dftemp folder completely for any residual configuration and then launch Azure Emulator separately to verify there are no issues
Procmon "http://technet.microsoft.com/en-us/sysinternals/bb896645" may help you find the file that is missing...
Hopefully someone stumbles upon this answer with similar symptoms. When removing in role caching the <dataCacheClients> section was removed from . Somehow there was a left over <dataCacheClients> section left in the web.config. Everything and compiled and deployed to the emulator successfully. However, the role would fail to start since applicationHost.config was missing.
The fix was simply remove the unnecessary <dataCacheClients> section from the web.config file.