Опубликован: 30.05.2011 | Доступ: свободный | Студентов: 2366 / 213 | Оценка: 4.12 / 4.41 | Длительность: 12:00:00
Самостоятельная работа 7:

Работа с Windows AzureQueue

< Лекция 16 || Самостоятельная работа 7: 12345 || Лекция 17 >

Список вспомогательных материалов

Работа с Windows Azure Queue

  1. http://msdn.microsoft.com/en-us/wazplatformtrainingcourse_exploringwindowsazurestoragevs2010_topic4
  2. http://dotnetbyexample.blogspot.com/2009/07/storing-objects-as-compressed-messages.html
  3. http://soumya.wordpress.com/2010/05/20/azure-simplified-part-4-using-azure-queue-storage/
  4. http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,c24f8177-f6bf-479b-bd5c-d532e0e40272.aspx

Приложение А AzureQueueSample.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;
using Microsoft.WindowsAzure.ServiceRuntime;


namespace WebRole1
{
    public partial class AzureQueueSample : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_send_Click(object sender, EventArgs e)
        {
            var storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
            var queueClient = storageAccount.CreateCloudQueueClient();
            var queue = queueClient.GetQueueReference("messagequeue");
            queue.CreateIfNotExist();
            var msg = new CloudQueueMessage(tb_message.Text);
            queue.AddMessage(msg);
            tb_message.Text = string.Empty;
        }


    }
}

Приложение Б Global.asax.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.ServiceRuntime;

namespace WebRole1
{
    public class Global : System.Web.HttpApplication
    {

        void Application_Start(object sender, EventArgs e)
        {
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
            });

        }

        void Application_End(object sender, EventArgs e)
        {

        }

        void Application_Error(object sender, EventArgs e)
        {

        }

        void Session_Start(object sender, EventArgs e)
        {

        }

        void Session_End(object sender, EventArgs e)
        {

        }

    }
}
< Лекция 16 || Самостоятельная работа 7: 12345 || Лекция 17 >
Роза Мальцева
Роза Мальцева
Игнат Гринько
Игнат Гринько

Примерно месяц назад получил на сайте код Дримспарк, сегодня вводил его на сайте Дримспарк, пишет: Недействительный код проверки. Проверьте правильность введенного кода. Код вводил методом: скопировать-вставить.