问题标签 [slsvcutil]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
181 浏览

c# - slsvcutil 生成不完整的代理

我一直在使用 Slsvcutil 为我的 WCF 服务生成代理,这将与 Xamarin.ios 兼容。我从来没有遇到过问题。但是,今天,我尝试更新我的代理,结果合同不完整。

以前我会使用命令行:

"C:\Program Files (x86)\Microsoft SDKs\Silverlight\v5.0\Tools\\SlSvcUtil.exe" http://localhost/Service.svc /out:Service.cs

它会生成一个数据合约服务。现在它生成一个只包含 XmlSerialization 属性的服务文件——这显然对我不起作用。

因此,我修改了命令行参数以强制 DataContract 序列化:

"C:\Program Files (x86)\Microsoft SDKs\Silverlight\v5.0\Tools\\SlSvcUtil.exe" http://localhost/Service.svc /mc /serializer:DataContractSerializer /out:Service.cs

这正确地导致了 DataContract 序列化,但是,我的 C# 代理完全省略了所有消息合同(我认为/mc应该修复)。所有方法签名都接受“对象”作为参数,以前它们是正确的完整合同,描述所有参数成员。

我能看到的唯一区别是运行时的版本已经改变......(在生成的代理文件的标题中标记):

0 投票
1 回答
834 浏览

c# - 安装 VS 2015.1 / .NET 4.6.1 后 Silverlight 5 SDK SLSvcUtil 错误

我使用 Silverlight 5 SDK 工具SLSVCUTIL生成用于 Xamarin 的 WCF 服务元数据。这是将 URL 传递给 svc 和生成内容的 /d 输出文件夹的基本用法。多年来它一直运作良好。

今天我安装了 .NET 4.6.1,重新启动,然后安装 VS 2015.1,似乎有些东西破坏了 SLSVCUTIL。我在管理员命令提示符下运行代码,出现以下错误:

错误:工具中发生错误。

错误:对象引用未设置为对象的实例。

任何人都知道如何在 .NET 和 Visual Studio 2015 的最新更新后解决这个问题?我尝试卸载/重新安装 Silverlight 5 SDK 但没有任何变化。

0 投票
1 回答
1657 浏览

wcf - Generate a WCF client proxy for a netstandard Xamarin.Forms project

I've created a Xamarin.Forms project with a netstandard2.0 targeting library instead of a shared or PCL library. So far this compiles and works. I'm using an up2date version of Visual Studio 2017 Community.

I also have created a WCF service that gonna be hosted on windows itself (not IIS). I've configured my app.config to provide a Metadata Exchange Endpoint:

This is a very simple configuration and I don't care about security for now. The service runs, successfully.

Now I cannot simply add a service reference to my Xamarin.Forms project, since netstandard does not provide System.ServiceModel.

I've found out that I can use the SLsvcUtil.exe from the Silverlight SDK to generate the client proxy for my WCF service that is compatible to Xamarin.Forms targeting netstandard instead, however I cannot get it running.

No matter how I try to use the SLsvcUtil.exe while my WCF service is running, I always get the error:

Here is my batch that I used to execute SLsvcUtil.exe:

http://localhost:8731/MM/mex returns the full WSDL, successfully.

How can I get a working generated client proxy for my Xamarin.Forms app that is targeting netstandard2.0? I'm open for any alternative that leads to the same desired result.