开发者

How does ServiceConfiguration.cscfg and ServiceDefinition.csdef play with WebConfig in Azure?

开发者 https://www.devze.com 2023-01-15 20:37 出处:网络
I have a big Silverlight app which I have successfully converted and added a CloudService project. I have uploaded the database to SQL Azure, and from my webconfig file with a connection to this datab

I have a big Silverlight app which I have successfully converted and added a CloudService project. I have uploaded the database to SQL Azure, and from my webconfig file with a connection to this database on SQL Azure everything works fine. So, my next step, where I'm crashing, was when adding a Cloud Service to my solution and setting that service as a startup project.

So, I'm guessing that I'm not adding the connectionstring correctly to ServiceConfiguration.cscfg/ServiceDefinition.csdef ?

Error I get is: Error message is for Query LoadUsers: System.ServiceModel.DomainServices.Client.DomainOperationException: Load operation failed for query 'LoadUserInfo'. The remote server returned an error: NotFound.....

My connectionstring look like this in webconfig:

<开发者_如何转开发add name="LiveEntities"   connectionString="metadata=res://*/LiveModel.csdl|res://*/LiveModel.ssdl|res://*/LiveModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.;Initial Catalog=Live09092010;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

Do I need to put the same connectionstring into ServiceConfiguration.cscfg/ServiceDefinition.csdef and how should it look like?

Solution Live
 SilverLight App proj 1
  --files
 Silverlight App proj 2
  --files
 Silverlight App proj 3...
  --files...

 Live.Web
  --My Project
  --Default.aspx
  --Web.config
  --etc..

 LiveCloudServices
  Roles
   --Live.Web
  --ServiceConfiguration.cscfg
  --ServiceDefinition.csdef


The Serviceconfiguration.cscfg and Service Definition.csdef help define how the Azure Fabric will host your app. Application settings do now have to sit in these files if you have no need for them to be there.

Basically, something else is wrong. I'll edit this if you provide a bit more insight (from comments), but wanted to answer your actual question.

The times you would want to use settings in the cscfg file is when you'd need to be able to change these settings during runtime or without taking the service down for them to impact. Variables used in that context are defined in the Service Definition and then have their value set in ServiceConfiguration.

Then the .cscfg file can be uploaded during runtime, which will raise an event in your app. You can hook this event and respond as you'd see fit.


Thanx for pointing me in the right direction, after some testing in the local DevFabric I was able to narrow down my problem. It ended up beeing a stupid Copy Local beeing set to false reference in one of my silverlight projects. I'm so happy for beeing up running on Azure :)

0

精彩评论

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

关注公众号