Archive for category Azure

Download your deployed application from Azure

Need to download the web application and files you deployed into Azure? Bring up the Azure portal. I’m using the “new” version (it’s been out for years now, but I still consider it the new one). Then, select your application to bring up the properties. From the list of actions, select “Get publish profile”:

Azure publish settings

Azure publish settings

Open the publish profile file and you’ll see all kinds of wonderful XML. There are a couple of <publishprofile> elements inside. Look for one that defines the FTP publishing information, like this:

<publishProfile profileName=”MyApp – FTP”

Find the userName and userPWD settings under the FTP profile section – they are located right after the “ftpPassiveMode” setting is declared. Just plug in your username and password into your favorite FTP client, and away you go!


Leave a comment

Path too long message when publishing from Visual Studio

While attempting to publish a web app from Visual Studio 2013 to Azure, I ran across this message:

The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

Searching the Internet provided many possible solutions, most involved modifying the MSBuild settings. None of them worked, unfortunately.

What did work, though, was moving the file to a shorter directory. So instead of hosting my project in C:\Users\scott.stoecker\Documents\Visual Studio 2013\Projects\ScottsApp folder, I moved it to C:\Projects, and that worked great.

1 Comment

Azure web job aborted due to no output

My long-running (but fun-loving) web job because un-loving when it failed, and I saw this error in the log:

[01/24/2015 13:44:48 > 0298bf: SYS INFO] Status changed to Initializing
[01/24/2015 13:44:48 > 0298bf: SYS INFO] Run script ‘ScottsProgram.AzureWebJob.exe’ with script host – ‘WindowsScriptHost’
[01/24/2015 13:44:48 > 0298bf: SYS INFO] Status changed to Running
[01/24/2015 13:48:49 > 0298bf: ERR ] Command ‘cmd /c ScottsProgram.AzureWebJob …’ aborted due to no output and CPU activity for 121 seconds.  You may increase SCM_COMMAND_IDLE_TIMEOUT setting to solve the issue.
cmd /c ScottsProgram.AzureWebJob.exe
[01/24/2015 13:48:49 > 0298bf: SYS INFO] Status changed to Failed

So I did my due diligence (I spent a lot of time in large corporate environments in the not so distant past) and found that setting the SCM_COMMAND_IDLE_TIMEOUT variable in the “app settings” section of my Azure web site was the way to go. So I did that and… it did nothing. Same error.

So I did further due diligence and found another suggestion to use the WEBJOBS_IDLE_TIMEOUT app setting. I set that one to an acceptably high value (3600 is a great number), and this one worked, and my web job became loving again.


“Cannot generate SSPI context” in Azure

I had been happily working on a piece of the functionality that included logging to a SQL Server database. Since all looked good locally, I uploaded my application to my Azure web site to run as a web job. When I checked the Azure logs for my web job, the Sad Clown of Life struck, and my job had failed. In the log I found some SQL errors, the telltale message being this:

 “The target principal name is incorrect. Cannot generate SSPI context”

 Turns out that Azure doesn’t like the line “Integrated Security=True” in the connection string. After adjusting my connection string, all was well.

Leave a comment

A note about DateTime queries in Azure

While running a query in Azure based on the last updated time (I had a DateTime  field in my table), I was not getting the results I expected. I had rows whose last updated time was over an hour ago, and I was running a query that would return all records over an hour old, but I wasn’t getting those rows back.

The problem was that I was using a GETDATE() call in the stored procedure, which was in SQL Azure. However, the time that I was using to pull the records was in my local development environment. The time on the Azure site were quite different than on my system.

There are a couple ways to solve this. Using UTC time is one way. Consistently using the GETDATE() call so that it is used in the same environment is another. (Calling the function only on the SQL Azure database, or passing in a DateTime from an application as a parameter to a stored procedure.) I went with the latter, and it worked fine. Just something to keep in mind.

Leave a comment

404 error when querying an Azure table

I was doing the Azure thing, writing some very useful coding – looking up people by their first name. This is a highly advanced software system, and I may try to get a patent for it, so don’t sell this:

// More code above... 
var table = tableClient.GetTableReference("peoplenames");
 var query = from item in table.CreateQuery<People>()
    where item.PartitionKey == "scott"
    select item;
 foreach (People entity in query)
  string firstName = entity.PartitionKey;
  string lastName = entity.RowKey;

When I ran this code, I got a very curious error:

 An exception of type ‘Microsoft.WindowsAzure.Storage.StorageException’ occurred in Microsoft.WindowsAzure.Storage.dll but was not handled in user code

 Additional information: The remote server returned an error: (404) Not Found.

The reason for this is that the “peoplenames” table didn’t exist. If I had wanted to check if a table existed, I could use the Exists() method:

 if (!table.Exists())
  // Do something

Leave a comment