开发者

Windows Azure Startup from a pre-existing MVC2 app

I have an already existing .NET MVC2 App that, because that we are wasting 80Gb of bandwidth per day and I want to place it in the cloud for to be more scalable as well cheap.

I was looking around and there is almost no alternative of Azure if we are in Europe, but I already have a 700 hours account on Azure.

  • I installed the latest SDK of Azure on VS2010
  • I created the cloud app
  • I said nothing when asked to add a role
  • I manually add 2 roles selected the existing projects in the solution that I had imported before

Windows Azure Startup from a pre-existing MVC2 app

Because I always get an error when trying to work with the certificates (even with the correct credentials it cant fetch the existing certificate on the cloud) I compiled into a package and uploaded as production

Never worked!, then I removed one and uploaded alone the "frontend" and I get the same stuff that I'm not used to and I have no idea what to do

Windows Azure Startup from a pre-existing MVC2 app

And it's like this for almost 4 hours now:

Windows Azure Startup from a pre-existing MVC2 app

Can I have some help with this? I have no one to turn to and you guys have been my best friends in my most hard programming times.***

Role is the default role

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Diagnostics;
using Microsoft.WindowsAzure.ServiceRuntime;

namespace BackendWebRole
{
    public class WebRole : RoleEntryPoint
    {
        public override bool OnStart()
        {
            DiagnosticMonitor.Start("DiagnosticsConnectionString");

            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
            RoleEnvironment.Changing += RoleEnvironmentChanging;

            return base.OnStart();
        }

        private void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e)
        {
            // If a configuration setting is changing
            if (e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange))
            {
                // Set e.Cancel to true to restart this role instance
                e.Cancel = true;
            }
        }
    }
}

And ServiceConfiguration.cscfg

<?xml version="1.0"?>
<ServiceConfiguration serviceName="CloudServic开发者_运维知识库e" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
  <Role name="Julekalender (Frontend)">
    <Instances count="2" />
    <ConfigurationSettings>
      <Setting name="DiagnosticsConnectionString" value="DefaultEndpointsProtocol=https;AccountName=julekal;AccountKey=xR4G1SIUTSHdvAE1IpRKPoxJRr1upJjBcdqRX2GWGkwlO6tbbu30Bikz/ApBzUKhRvk+XaozvE/NIAwDzKCg==" />
    </ConfigurationSettings>
  </Role>
  <Role name="Julekalender (Backend)">
    <Instances count="2" />
    <ConfigurationSettings>
      <Setting name="DiagnosticsConnectionString" value="DefaultEndpointsProtocol=https;AccountName=julekal;AccountKey=xR4G1SIUTSHdvAE1IpRKPoxJRr1upJjBcdqRX2GWGkwlO6tbbu30Bikz/ApBzUKhRvk+XaozvE/NIAwDzKCg==" />
    </ConfigurationSettings>
    <Certificates>
    </Certificates>
  </Role>
</ServiceConfiguration>

And ServiceDefinition.csdef

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="CloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
  <WebRole name="Julekalender (Frontend)" vmsize="Medium">
    <InputEndpoints>
      <InputEndpoint name="HttpIn" protocol="http" port="80" />
    </InputEndpoints>
    <ConfigurationSettings>
      <Setting name="DiagnosticsConnectionString" />
    </ConfigurationSettings>
  </WebRole>
  <WebRole name="Julekalender (Backend)">
    <InputEndpoints>
      <InputEndpoint name="HttpIn" protocol="http" port="8081" />
    </InputEndpoints>
    <ConfigurationSettings>
      <Setting name="DiagnosticsConnectionString" />
    </ConfigurationSettings>
    <Certificates>
    </Certificates>
  </WebRole>
</ServiceDefinition>


If you don't use the Windows Azure MVC template, you'll need to make sure you mark the appropriate DLLs as "copy local" (because they don't exist in the cloud). I believe these are the DLLs you need to do this with:

  • System.Web.Abstractions
  • System.Web.Mvc
  • System.Web.Routing

Just go to the properties for each of these references and set "copy local" to "always."


Are you by chance missing WebRole.cs and WebWorker.cs files in your roles? If they have been created by Visual Studio, are they pointing to valid non-Dev-Storage account?

I don't know the new setting in v1.3 SDK, but in v1.2 SDK it was called DiagnosticsConnectionString in ServiceConfiguration.cscfg file in your CloudService project

If both check out, please post your WebRole and WorkerRole files?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜