Azure Cloud Deploy Keeps Recycling - deployment

I get the following error:
Recycling (Waiting for role to start... Sites are being deployed.
[2012-12-17T05:30:10Z])
Running One or more role instance is unhealthy. 1 Instance: 1
Unhealthy
i was actually trying to convert my web application to a cloud applicaton.
here is what i did:
i added a cloud project to my solutions,
i added a webrole which linked to my web app
i created an sql azure database and copied my whole structure and also the data to the db
i inserted the connection string in my webconfig and tried to run it on emulation, this worked fine
then tried to deploy it by creating a cloud service, running the builder to create the packages and uploading the packages in "staging" mode. this is where i got the errors.
i tried to create an empty cloud app and add a default webrole and load this to the cloud, this worked fine. so i figured, maybe i have something wrong in my settings of my webrole.
I checked the difference between both and i noticed that in both solutions diagnostics was enabled but the storage account was empty in my own solution, so i inserted "UseDevelopmentStorage=true" here. this didn't change anything tho. I also saw a difference in the "packages.config"
default role had:
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="1.7.0.0" targetFramework="net40" />
<package id="System.Web.Providers" version="1.1" targetFramework="net40" />
<package id="System.Web.Providers.Core" version="1.0" targetFramework="net40" />
<package id="WindowsAzure.Storage" version="1.7.0.0" targetFramework="net40" />
mine had:
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="1.7.0.0" targetFramework="net35" />
<package id="WindowsAzure.Storage" version="1.7.0.0" targetFramework="net35" />
i tried changing in this and uploading, didn't do anything
I am not using a worker role, i have only 1 running instance (same as default)
my application uses some authentication in global.asax where it tries to read from User.Identity.Name and compare with a user in the database (this user is inserted in the sql azure db). At first I thought this would maybe be the cause of the problem, but even if i comment out this code the application will not run on the cloud.
VM size is small, trust level = Full trust
I also saw some differences in the settings where i had remote access parameters. I tried removing all these just to exclude issues
i read something about settings references to "copy local is true", but im not sure if this will do any difference.
Any ideas because I don't really know what to do anymore
EDIT:
I modified all the references to "copy local is true" and i disabled to diagnostics just to be sure there's nothing wrong with it.
but now i get the error:
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Funny thing is, in my webconfig this is already set... And I can only find 1 webconfig.
I'm not quite sure what I'm doing wrong

"Keep recycling" almost always means that there are some exception occurred when your application was started. You might not be able to see any errors or exceptions in through the Diagnostics Montor since your exception might be occurred before you configured and started the diagnostics.
I recommend you enable the IntelliTrace option when deployment. It's very easy to do if you are using Visual Studio. Then you can retrieve the IntelliTrace result through Visual Studio and figure out what exception occurred. I strongly considered there are some references missed on azure that you need to set Copy Local = true. But you need IntelliTrace to find them.

The problem was that I had some referenced projects that had an app.config file with a string to a local database

Related

Not able to get MongoDB.driver nuget for Webapi project

I am new to MongoDB and is trying to get this new Database connected with my Web api application ..But i am not able to add MongoDB.driver nuget for my Webapi project.Please refer screen shot.
My search is struck on this window for like forever.,have even restarted my project for a couple of times now.
I also tried installing this package through
PM>Install-Package MongoDB.Driver
But then this is shown
Am I doing something wrong ..?
i tried opening this url"api.nuget.org/v3/index.json"...but it says this site cant be reached..what does that mean?
Since the you could not open the url in browser directly, there should be some internet limitations in your internet environment. If you are work in the company, I suggest you contact your office IT to confirm whether they add any limitations and whether used any proxy. If they are using some proxy, you need to set the proxy settings in NuGet.Config file which store in C:\Users\user name\AppData\Roaming\NuGet as below settings. Detailed information please refer to the Proxy settings part in Nuget Config Section & Nuget Proxy Settings.
<add key="http_proxy" value="host" />
<add key="http_proxy.user" value="username" />
<add key="http_proxy.password" value="encrypted_password" />
Besides, you can chech the proxy in your machine: Open "System Properties" > Advanced > Environment Variables. Find the http_proxy var (in System variables), select and delete it.

Migrations and configuration.seed not running on Azure deployment

I am on EF, with a standard code first DbContext.
public class MyContext : DbContext {}
My seed method in Configuration.cs runs fine locally, when I do an 'Update-Database'
But when I deploy to an Azure Web App instance, none of my seed data shows up. My initial migration runs, but when I add a new migration and publish, it does not get run. So basically only my Initial migration is showing up, and no seed data.
If I check 'Update database', the publish just hangs indefinitely.
I have read that there is supposed to be an 'Execute code first migrations' checkbox, but I don't seem to have that checkbox. I have tried cleaning my project, and restarting VS2013update4. Rebuilding the project, etc. Nothing makes it show up. I have also tried this: http://www.dominicstpierre.com/2012/11/enable-code-first-migrations-check-box.html, but it doesn't seem to work with VS2013u4.
Migrations are in my MyProject.DataLayer project. The actual web app is in MyProject.WebApp. Will this matter? It works fine locally.
What can I do to get this checkbox to show up?
Entity Framework sets up an initialiser on the target machine web.config
This initialiser is run when your app hits the database for the first time.
Here is a link to a good article on the asp.net site that explains how to achieve this: http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/migrations-and-deployment-with-the-entity-framework-in-an-asp-net-mvc-application
I had the same issue, the seed would simply not get executed after an azure deployment.
I fixed this by adding this to the entityFramework element in the web.config:
<entityFramework>
<!-- excluded other settings for brievity... -->
<contexts>
<context type="WebApplication.Data.ApplicationDbContext, WebApplication" disableDatabaseInitialization="false" >
<databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion`2[[WebApplication.Data.ApplicationDbContext, WebApplication], [WebApplication.Migrations.Configuration, WebApplication, Version=1.0.0.0, Culture=neutral]], EntityFramework" />
</context>
</contexts>
</entityFramework>
It is important that the namespaces are correct for ApplicationDbContext and Configuration, otherwise it will not work.

bin/*.dll locked when deploying website after app_offline.htm copied and active (shadow copy off)

I am running into an issue deploying a website. Shadow copy is turned off after previous deployment issues with it and deploying the site.
Specifically at deploy time I find that even after copying app_offline.htm and verifying that the site/application is offline, the files in bin/*.dll are often locked.
With shadow copy off I would still expect the locks on the dll's to be free'd when the appdomain is unloaded on app_offline.htm appearance.
I have tried deploying a temporary web.config found on Stack Overflow which aims to prevent changes (to bin/) being picked up immediately just before I try to delete the contents of bin/
I even pause for 10s after copying the new web.config.
?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<httpRuntime waitChangeNotification="300"
maxWaitChangeNotification="300"/>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
I have confirmed with the handles util that my application pool (w3wp.exe process) is the holder of a lock on the dlls so am assuming this is the reason why I cannot delete/overwrite the files. If i manually recycle the app pool it frees it up and I am able to deploy just fine. Unfortunately as part of the deploy process copying the app_offline and changing the web.config are possible but performing IIS appcmd recycles are not (for permissions/group policy reasons) so I really need to be able to free up this lock with just app_offline.htm and the web.config.
Turning shadow copy back on does 'solve' this particular issue but if a lock is still held on the dll. However I wonder / and concerned if I am just postponing the problem. Unless the lock on the old dll is free'd when the appdomain is loaded again?
When copying the app_offline.htm the w3wp process id doesn't change like it does with a hard recycle but I assume it is unloading the appdomain which should free the bin/ files it has locked.
Another interesting point is that this only appears to happen on our production servers, I cannot recreate it locally or on our dev/staging sites. I don't believe there is any config difference with the app_pools or IIS config but could this possible cause this behavior.
Also to clarify shadowCopyBinAssemblies has been set to false for over 3 years without this problem happening (same deploy process) so I really feel like something that happened recently caused this, but I have no idea what.
Thanks for any ideas on how to solve this or even what might be causing it.
(I believe the server is IIS7 or 7.5)
I am running into a similar issue where a DLL is locked by IIS even with the presence of app_offline.htm.
Restarting the pool solves the issue but it is manual. Looking for an automated way. In my case the DLL is PDFium.dll it is likely an unmanaged dll

VS2012 WebDeploy Publish Breaking Web.Config

I have a MVC3 Web Application project that I develop and publish from Visual Studio 2012. This was recently a VS2010 project that was migrated.
My web.config is setup using a <location inheritInChildApplications="false"> tag so that a child application running in a virtual directory does not take on the settings.
I have setup a WebDeploy publish profile, which worked flawlessly in VS2010, but breaks my application when published from VS2012. It adds a <connectionStrings> node after the closing aforementioned </location> tag, even though I already have a <connectionStrings> node inside my <location> node. This breaks the app due to an invalid configuration file.
I've tried re-creating the profile from scratch which didn't solve the problem.
Based on what I have read here, http://msdn.microsoft.com/en-us/library/dd465337.aspx, unchecking the "Use this connection string at runtime" checkbox should instruct the publish process to NOT add the connection string, but it does anyway.
I'm thinking that this would not be an issue if I wasn't using the <location inheritInChildApplications="false">, because the connection string would get added to the right spot.
Also, note that if I publish to the File System instead of using WebDeploy, the published Web.Config is created correctly and does NOT have the extra connection string node added.
Are there any known workarounds for this issue?
As I suspected, this issue is related to the inheritInChildApplications attribute. It is likely a bug in the Visual Studio 2012 Web Deploy whereby the deploy process always adds the connection string to the configuration file, even if you tell it not to. In my case, it was also adding in the wrong spot, which broke my application.
To fix the issue, I simply stopped using the attribute and turned off configuration inheritance using one of the options listed here.
I can now publish without errors, but the process still adds the connection string to the deployed configuration file. Annoying but not a show stopper.

Crystal Reports images not visible in web viewer

I have some Crystal Reports (V10) in an application (.NET 1.1) I inherited that is deployed in four "identical" environments. In three of the environments, they are working fine. In the fourth, the chart graphics are not visible in the web viewer. They are visible if you export the reports.
The IT guys swear everything is exactly the same in all four environments and have kicked the problem back to me to solve. I'm not sure how I'm going to do that since I can't get to the servers to check anything for myself. But I don't see how this can NOT be an environment issue.
It seems to me that Crystal has the necessary permissions to write the file and to retrieve it to render the export versions of the report, but the ASP WP can't access the graphic file when the page is rendered.
Thanks for any suggestions you might have to help me!
RESOLUTION
From the IT guys: "We had to change the “Execute Permissions” on the CrystalReportsViewer10 folder within IIS from “Scripts only” to “Scripts and executables”. All of the other sites have only “Scripts Only” and they’re fine."
I could resolve this issue in dev enviroment adding next keys (handlers) to web.config:
<system.webServer>
<handlers>
<add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode"/>
</handlers>
</system.webServer>
<system.web>
<httpHandlers>
<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</httpHandlers>
</system.web>
There needs to be an IIS virtual directory called something like "CrystalReportViewers115". I think that the exact name changes between versions. This needs to be visible to your ASP.NET user. Start looking at the environments that work and see if they have this virtual directory installed, and compare it to the one on the failing environment. As another check, you should be able to enter in the URL for the images into a browser and see them. To find out the URL, right click on the picture and select "Properties". For example:
http://localhost/crystalreportviewers/images/toolbar/export.gif
You should see the picture when you browse directly to the URL.
Go to Start->Programs->Microsoft Visualstudio 2008->Visual Studio Tools->Visual Studio 2008 Command Prompt
and type
aspnet_regiis -c
This will automatically copied the corresponding files...
Add the aspnet_client folder in the source folder of the site. Example:
C:\inetpub\wwwroot\myapplication\aspnet_client\system_web\4_0_30319\CrystalReportWebFormViewer4
I recently experienced this very issue: although my resolution was a little different:
I tried setting the handler in the web.config but that didn't fix it.
I tried setting scripts & executables in IIS but that didn't fix it.
Once I went into the C:\Program Files\Common Files\Crystal Decisions\2.5\crystalreportviewers10 folder and turned off custom errors I could see the error was coming from an access denied issue on C:\Windows\Temp\
The solution was then to not and handlers or alter IIS to run scripts and executables, it was to allow the Network Service to read permission on C:\Windows\Temp\
EDIT:
Think I've found another solution which doesn't require permission changes... just set a virtual directory for aspnet_client; the level at which you select this will very much depend on your IIS layout.