我目前正在使用Build in Visual Studio Team Services(是Visual Studio Online),并且希望能够在Build Step中设置Build变量,以便可以在后续的Build Step中使用新值.
显然你可以在Build开始之前设置它,但我希望在后续的Build Step中后期绑定变量.
尽管阅读了很多帖子,例如(这个似乎很受欢迎)我似乎无法将我的服务作为多个端点公开,这些端点兼容SOAP和REST协议 - 我的问题似乎与
Factory="System.ServiceModel.Activation.WebServiceHostFactory"
Run Code Online (Sandbox Code Playgroud)
后台服务代码中的元素.
如果我将其删除,我的SOAP端点工作正常,但找不到我的JSON端点.如果我将该行放入,我的REST端点会像鸟一样唱歌,而SOAP端点会导致Service.svc页面上出现"Endpoint not found".
我的操作似乎以标准方式设置,例如:
[OperationContract]
[WebGet(UriTemplate = "/GetData", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
string GetData();
Run Code Online (Sandbox Code Playgroud)
和配置文件
<endpoint address="rest" binding="webHttpBinding" contract=".IMeterService" behaviorConfiguration="REST" />
<endpoint address="soap" binding="wsHttpBinding" contract="IMeterService" bindingConfiguration="secureBasic" />
<behavior name="REST">
<webHttp />
</behavior>
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?有没有办法在没有 System.ServiceModel.Activation.WebServiceHostFactory属性的情况下设置REST端点?
提前致谢.
例如,我在IIS中托管了两个服务.
[ServiceContract]
public interface IDeviceService
{
[OperationContract]
DeviceCollection GetAllDevices(Customer customer);
}
[ServiceContract]
public interface IUserService
{
[OperationContract]
User Authenticate(string username, string password);
}
Run Code Online (Sandbox Code Playgroud)
从UserService中的Authenticate操作返回的User对象和从DeviceService中的GetAllDevices操作返回的DeviceCollection都具有Customer的子对象定义.Customer是一个业务对象与User和Device对象在同一个程序集中.
我的问题出在客户端 - 当我调用设备操作时
userProxy.GetAllDevices(user.Customer);
Run Code Online (Sandbox Code Playgroud)
编译器抱怨以下消息:
参数1 - 无法从UserService.Customer转换为DeviceService.Customer
我可以很好地连接到两个服务,这是Customer的对象定义就是问题.我真的不想把操作放在他们看似在自己的服务中自然生活的相同服务中.我想我要问的是,其他程序员如何处理这样的问题呢?
干杯,斯图尔特
I'm trying to get the number of digits in the following double value: 56.46855976 without using converting it to a string (and simply replacing the "." with a "").
Anybody got any ideas?