SharePoint 2010 - 如何与 ServiceStack.net 服务通信
本文关键字:ServiceStack net 服务 通信 2010 SharePoint | 更新日期: 2023-09-27 18:32:33
是否可以使用强类型客户端在 SharePoint 2010 和服务堆栈服务之间进行通信?ServiceStack 客户端库在 .net 4 框架上运行(不正确,请参阅我的编辑部分((SP2010 在 .net 3.5 上(导致 BadFormatImage 异常...
我尝试通过WCF向导(从共享点设计器(进行连接,但没有成功。
编辑真正的问题在于我的 nant 任务签名堆栈库。我使用 .net 4 ilasm 而不是 2.0。
<target name="signss" description="sign service stack assemblies">
<foreach item="File" property="filename">
<in>
<items basedir="lib">
<include name="**/ServiceStack*.dll" />
</items>
</in>
<do>
<echo message="${filename}"/>
<echo message="${path::get-directory-name(filename)}"/>
<exec failonerror="true" program="C:'Program Files (x86)'Microsoft SDKs'Windows'v7.0A'Bin'ildasm.exe">
<arg value="${filename}" />
<arg value="/out:${path::get-directory-name(filename)}/${path::get-file-name-without-extension(filename)}.il" />
</exec>
<exec failonerror="true" program="C:'Windows'Microsoft.NET'Framework64'v2.0.50727'ilasm.exe">
<arg value="${path::get-directory-name(filename)}/${path::get-file-name-without-extension(filename)}.il" />
<arg value="/dll" />
<arg value="/key=ss.snk" />
<arg value="/output=${path::get-directory-name(filename)}/${path::get-file-name-without-extension(filename)}.dll" />
</exec>
</do>
</foreach>
</target>
Nant 任务现在将库签名并重新编译为 .net 2 程序集,但当我尝试在我的 sharepoint 2010 解决方案中使用 ServiceStack.Common 时,我仍然遇到问题。
var client = new JsonServiceClient("http://host:8080/");
给出错误
错误 16 类型"ServiceStack.Service.IServiceClientAsync"在未引用的程序集中定义。必须添加对程序集"ServiceStack.Interfaces, Version=3.9.60.0, Culture=neutral, PublicKeyToken=null"的引用。
我应该更改引用程序集中的公钥标记,现在是空...我将尝试编辑 nant 任务以更正 .il 文件上的该键。
如果要将服务堆栈客户端与 sharepoint 2010 一起使用,则应:
- 从 github 下载源代码(使用 .net 3.5 的最新提交(:
服务堆栈 https://github.com/ServiceStack/ServiceStack/commit/4cdc5b5a87ea18dce77840252b72e680e29a6bd5
ServiceStack.Text https://github.com/ServiceStack/ServiceStack.Text/commit/cd1f130c1a9a2c4c79e62fb3e487197956d1f56b
- 对程序集 ServiceStack.Common、ServiceStack.Text、ServiceStack.Interfaces 进行签名