views:

52

answers:

2

I've made two small/test Silverlight apps with VS2010 (I am new to it), having same problem with both... When I run/debug it from within VS2010, the app runs and it connects to the database fine. But when I publish it to the IIS (on the same machine VS2010 is on), the app will run, but it will not connect to the database.

I'm using SQL Server authentication.

The machine Windows 7 Premium (i also have the same problem on a Windows 7 Pro machine) using IIS 7.5.7600.16385

I've had this problem on multiple machines (my colleagues have it too)... It's quite frustrating that we can't make our SLight apps work (connect to DB) from IIS, only when running from VS2010. Hopefully it's a simple change to "fix" it.

I've tried with the database being on the same machine as the IIS/VS2010, and being on a different one... in both cases, results are that it does work when run from VS2010, but not IIS.

I've tried what is mentioned here to no avail: http://www.codeproject.com/KB/silverlight/deploy-sl4-with-db.aspx

Otherwise, my IIS setup is mostly "out of the box".

My web.config file:

<?xml version="1.0"?>
<configuration>
<connectionStrings>
  <add name="myvisionexpressEntities" connectionString="metadata=res://*/Models.ContactsDM.csdl|res://*/Models.ContactsDM.ssdl|res://*/Models.ContactsDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=MACHINE_NAME\sqlexpress;Initial Catalog=dev;User Id=myuser;Password=mypassword;Integrated Security=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" /> 
  </connectionStrings>
<system.serviceModel>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
    multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.web>
  <compilation debug="true" targetFramework="4.0" />
  <httpModules>
    <add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </httpModules>
</system.web>
</configuration>
A: 

Just to clarify: Is it that your website cannot connect to the database? Are you using RIA Services to get Silverlight to connect to the database? Are you getting an error or just no data? Have you looked in the Windows Event Viewer on the server to see if IIS is dumping an error out to that?

I'd suspect that it's going to be permission based, have you connected SQL Server management studio to the database ok wherever it lives (the IIS site directory). If you haven't done so copy the site to the InetPub/wwwroot folder and it'll inherit the permissions for IIS users.

Dylan
A: 

Do you have an error message?

chadbr