0

我有一个包含 2 个项目的 Visual Studio 2010 解决方案。一个是 Silverlight 客户端,另一个是我添加了域服务的网站。在 Cassini 中调试时它工作正常,但是当我发布到 IIS 时,我的实体查询没有返回任何内容。

我什至不确定从哪里开始,因为这是我第一次尝试这样做。

4

3 回答 3

1

一些东西:

在 Cassini 上开发(如果可以避免就不要这样做)

针对 IIS 本身进行开发总是更好。IIS 和 Cassini 之间存在差异,如果您不了解它们,它们可能会咬你一口,而且它更有意义;您应该始终开发尽可能接近您正在开发的环境。除非您正在部署到 Cassini(您没有,没有人这样做),否则没有必要针对它进行开发,除非您根本不能(您没有本地安装 IIS)。

网络部署

在要部署到的 IIS 服务器上安装Web Deploy 。完成此操作后,您可以右键单击解决方案中的 Web/域项目并选择“构建部署包”。

然后,您将获得一个可与 Web Deploy 一起使用的包,它将通过简单的命令行调用将您的项目的所有内容(Silverlight、ASP.NET 组件等)部署到 IIS。

于 2010-12-06T16:32:16.803 回答
0

这是一个非常愚蠢的新手问题。我使用 SQL Server Profiler 观察查询进来,并意识到用于对 SQL Server 进行身份验证的帐户是服务器的计算机帐户。我保护了域服务的方法并允许计算机帐户访问他的数据库。

于 2011-03-23T15:42:36.777 回答
0

部署到 IIS 可能会有一些问题。我想看看您收到了哪些错误消息。如果没有这些信息,就很难给你建议。

PS:我会假设您的 WCF RIA 服务具有有效的定义;-)。

根据我的经验,这是最低配置文件,但如果您使用身份验证域服务或数据域服务(例如 LinqToEntities 或 LinqToSql 域服务),它肯定需要更多设置:

确保您的 IIS 具有 WCF RIA 所需的所有部分

<?xml version="1.0"?>
<configuration>
  <configSections>
    <sectionGroup name="system.serviceModel">
      <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" allowDefinition="MachineToApplication" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <system.web>

  <!-- You might need identify tag if you app requires additional permission to run -->

  <!-- See you want to see more details when a error happens -->
  <customErrors mode="Off"/>
  <compilation debug="true" targetFramework="4.0" />

  <!-- If your application uses authentication and authoriztion then -->
  <!-- Elements required required for authentication: authentication and membership and probably roleManager -->


<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>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <add name="DomainServiceModule" preCondition="managedHandler"
          type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </modules>
  </system.webServer>

  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

</configuration>

确保 WCF RIA 服务已启动并正在 运行 尝试使用 Web 浏览器访问 WCF RIA 服务。通常,您公开的服务具有如下格式:

http://[主机名]/[命名空间名]-[类名].svc

因此,您应该能够点击 URL 并看到如下输出: 在此处输入图像描述

确保 DLLS 可用 在服务器端部署 WCF RIA dll 有两个选项。您可以向应用程序指示应将 DLL 复制到应用程序的 bin 文件夹中,或者您可以在服务器模式下运行 WCF RIA 安装程序。

从客户端访问服务 如果服务启动并运行,您的 Silverlight 客户端应该可以访问它们。如果出现错误,您可以通过启用 WCF RIA 调试来开始跟踪。有关它的更多详细信息,请参阅http://blogs.msdn.com/b/saurabh/archive/2010/03/16/ria-services-application-deployment.aspx

于 2011-01-24T22:19:28.697 回答