2

我正在尝试从 SQL Reporting Services 包装 ReportExecution2005,以便我可以代表 Windows Auth Services 登录进行域身份验证。

ReportExecution2005 定义

SetExecutionParameters(ParameterValue[] Parameters, string ParameterLanguage)

但是,当将任何类型的数组,甚至是字符串 [] 放入方法签名中时,服务编译得很好,但是当我尝试在 Silverlight 项目中设置服务引用时,VS2010 非常适合并且不会生成Reference.cs 的代码

显然,您可以使用数组参数,ReportExecution2005 这样做,VS2010 设法引用它。

一旦我从参数列表中删除数组成员,它就会停止呻吟并开始工作。谁能向我解释这里发生了什么?

如果我可以对这部分进行排序,我将拥有在 SL4 RIA 应用程序中提供 ReportViewer 等效功能所需的一切 - 我已经想出在父网页中动态创建 IFRAME,确定占位符控件的像素边界并动态调整IFRAME 的位置和 Z 顺序,以便它呈现 HTML,就好像它“在”占位符面板中一样。

我计划将它全部打包成一个控件并发布以供一般使用,直到 Microsoft 开始为 Silverlight 生成 ReportViewer 控件。剩下的部分是操作报告服务并返回呈现报告的字节。我可以直接在客户端中引用 ReportingServices,但不需要凭据来进行往返。

在确定故障性质的过程中,我用无所事事的方法构建了一个简化的服务,并逐步添加了一个参数,构建了服务并尝试添加它,直到出现问题。

一旦指定了数组参数,就会出现问题。我确信它是一个数组,而不是数组的类型,因为即使数组类型是像字符串这样的内置类型,服务器和客户端都肯定知道,问题也会发生。

这非常令人费解,因为数组参数得到了明确的支持——其他服务成功地使用了它们。这是错误消息:

Custom tool error: Failed to generate code for the service reference 
'ServiceReference1'.  Please check other error and warning messages for details.

没有其他错误消息。有六个警告,但其中大部分也发生在成功导入 Web 服务的情况下。

Custom tool warning:
  Cannot import wsdl:portType
Detail:
  An exception was thrown while running a WSDL import extension:
  System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error:
  Exception has been thrown by the target of an invocation.
XPath to Error Source: 
  //wsdl:definitions[@targetNamespace='']/wsdl:portType[@name='RS2010']
  C:\...\ServiceReference1\Reference.svcmap

Custom tool warning:
  Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
  C:\atom\Silverlight\Argent\Service References\RS2005\Reference.svcmap

Custom tool warning:
  Cannot import wsdl:binding
Detail:
  There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: 
  //wsdl:definitions[@targetNamespace='']/wsdl:portType[@name='RS2010']
XPath to Error Source: 
  //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='CustomBinding_RS2010']
  C:\atom\Silverlight\Argent\Service References\ServiceReference1\Reference.svcmap

Custom tool warning:
  Cannot import wsdl:port
Detail: 
  There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: 
  //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='CustomBinding_RS2010']
XPath to Error Source: 
  //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='RS2010']/wsdl:port[@name='CustomBinding_RS2010']
  C:\atom\Silverlight\Argent\Service References\ServiceReference1\Reference.svcmap
4

2 回答 2

2

如果在失败的引用上使用Configure Service Reference...,并从Reuse types in all referenced assembly更改为Reuse types in specified referenced assembly,然后取消选择System.ComponentModel.DataAnnotationsSystem.Windows.Browser你会发现问题消失了。

至少它适用于我的小例子。对于更精细的服务,事情可能会更微妙。

您可以在首先使用“高级”按钮设置参考时指定这些排除项。我总是忘记,并在以后遇到错误时使用配置。

于 2010-01-27T01:14:26.240 回答
0

您需要定义一个 ParameterValue 数组,然后将其传入。不是字符串数组。

像这样的东西...

ParameterValue[] paramarray = new ParameterValue[n];

--set them

paramarray[0] = new ParameterValue();
paramarray[0].Label = "Text";
paramarray[0].Name = "Key";
paramarray[0].Value = "1";

...

paramarray[n] = new ParameterValue();
paramarray[n].Label = "Text";
paramarray[n].Name = "Key";
paramarray[n].Value = "100";


...SetExecutionParameters(paramarray, "en-us");
于 2010-01-26T19:20:56.840 回答