标签: wcf

Odata Filter StartsWith of Integer字段

我在Odata服务连接的数据库中有一个int字段.我想知道是否可以在整数字段上执行StartsWith过滤器.

例如http://services.odata.org/Northwind/Northwind.svc/Customers?$ filter = startswith(CustomerID,'1')eq true

在此示例中,CustomerID将是int字段.目前即时收到错误400响应,我收集的原因是你不能在int字段上执行startswith.我可以以某种方式在过滤器中投射该字段吗?

提前致谢

wcf filter ipad odata

0
推荐指数
1
解决办法
2952
查看次数

帮助解释

我有一些代码,我觉得很难理解.有人可以帮我逐行分解吗?

Service1Client client = new Service1Client();
            client.getPrimaryListCompleted += new EventHandler<getPrimaryListCompletedEventArgs>(AddPrimaryMarkerGraphics);
            client.getPrimaryListAsync();
Run Code Online (Sandbox Code Playgroud)

c# methods silverlight service wcf

0
推荐指数
1
解决办法
357
查看次数

我可以组合WCF .config文件吗?

是否可以组合app.config文件和web.config文件.我是自托管服务并在IIS中托管它,发现自己必须编辑两个不同的文件?

wcf

0
推荐指数
1
解决办法
617
查看次数

C# - 如何在WCF服务中读取流

我有一个WCF服务,我想发送一个日志文件并在服务器上处理它.合同是:

[OperationContract]
void LogFile(Stream file);
Run Code Online (Sandbox Code Playgroud)

我在端点中使用StreamedRequest.

我遇到的问题是我无法找到一种方法来读取服务中的流.

当我调试调用时,我看到Stream是一个实例:

System.ServiceModel.Dispatcher.StreamFormatter.MessageBodyStream
Run Code Online (Sandbox Code Playgroud)

从客户端我发送一个MemoryStream.

那么......我怎么能读到这个流?

谢谢.

Edit1:即时通讯使用:

        Stream serviceStream = new MemoryStream();
        byte[] buffer = new byte[10000];
        int bytesRead = 0;
        do
        {
            bytesRead = file.Read(buffer, 0, buffer.Length);
            serviceStream.Write(buffer, 0, bytesRead);
        } while (bytesRead > 0);
        serviceStream.Position = 0;
Run Code Online (Sandbox Code Playgroud)

读取流,什么都没有,总是0

c# wcf stream

0
推荐指数
1
解决办法
5254
查看次数

在win2k8上部署时,WCF VSTO客户端无法找到默认端点

我在Win2008R2终端服务器上创建并部署了一个WCF客户端(从VSTO Word Addin启动).执行时,将InvalidOperationException抛出WCF代理的默认构造函数an ,表明无法找到合同的默认端点.

部署到Win7 x64计算机时,相同的WCF客户端使用相同的.dll.config运行正常

我试图在PowerShell中创建一个实例并收到相同的错误.

如果在PowerShell中创建专用端点,我可以执行一个服务方法:

$binding = New-Object System.ServiceModel.BasicHttpBinding
$endpoint = New-Object System.ServiceModel.EndPointAddress("http://myserver:7777/CompanyService.svc")
$client = New-Object MyClient.CompanyServiceReference.CompanyServiceClient($binding, $endpoint)
$v = $client.Version()
Run Code Online (Sandbox Code Playgroud)

服务Web.config(部分)

<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior>
                <serviceMetadata httpGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <bindings>
        <basicHttpBinding>
            <binding name="NoHttpSecurity" sendTimeout="00:03:00">
                <security mode="None" />
            </binding>
        </basicHttpBinding>
    </bindings>
    <services>
        <service name="CompanyService">
            <endpoint address="http://myserver:7777/mex" contract="IMetadataExchange" binding="mexHttpBinding" />
            <endpoint name="Version" address="http://myserver:7777/Version" contract="MyService.ICompanyService" binding="basicHttpBinding" bindingConfiguration="NoHttpSecurity" />
            <endpoint name="CompanyList" address="http://myserver:7777/CompanyList" contract="MyService.ICompanyService" binding="basicHttpBinding" bindingConfiguration="NoHttpSecurity" />
        </service>
    </services>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

MyClient.dll.config(部分)

<system.serviceModel>
    <bindings> …
Run Code Online (Sandbox Code Playgroud)

.net wcf vsto windows-server-2008

0
推荐指数
1
解决办法
1934
查看次数

WCF Restful Service .NET 4 IIS 7.5问题(带有“''的消息无法处理)

我有一个wcf restful服务并正在运行。如果使用WebServiceHost启动Web服务,则可以毫无问题地发出Get / Post。我尝试将wcf服务移至本地机器上的IIS 7.5,但似乎无法正常进行。

我尝试从wcf服务调用任何内容时都收到以下错误消息:(http:// wp9dbytr1k1:8081 / service.svc / AnythingHereForGETorPUT)。我在虚拟目录/设备中尝试过,但遇到了同样的问题。

The message with Action '' cannot be processed at the receiver, due to a     ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract  mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
Run Code Online (Sandbox Code Playgroud)

如果我直接调用svc文件(http:// wp9dbytr1k1:8081 / service.svc),它会很高兴并告诉我

“您已经创建了一个服务。要测试该服务,您将需要创建一个客户端并使用它来调用该服务。您可以使用以下语法从命令行使用svcutil.exe工具来执行此操作:svcutil.exe …

iis rest wcf iis-7.5

0
推荐指数
1
解决办法
2042
查看次数

WCF错误 - 邮件安全验证失败

我正在尝试使用新的WCF服务.该服务在分层安全性之前正在运行.现在我收到此错误:

An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.

Server stack trace: 
   at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout)
   at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at MyProject.IntegrationSample.MyProjectService.IMyProjectService.GetData(Int32 …
Run Code Online (Sandbox Code Playgroud)

.net wcf web-services

0
推荐指数
1
解决办法
1万
查看次数

WCF端点合同名称 - 如果它是通用的,如何分配它?

  • IGenericService驻留在名为"ABC.Server.Common"(ABC.Server.Common.dll)的程序集中
  • MyType驻留在名为"ABC.Server.Modules.X"(ABC.Server.Modules.X.dll)的程序集中

码:

public class ABC.Server.Modules.XService :
    ABC.Server.Common.IGenericService<ABC.Server.Module.X.MyType>
{
    ABC.Server.Common.GenericResponse<ABC.Server.Module.X.MyType> DoFoo(ABC.Server.Common.GenericRequest<ABC.Server.Module.X.MyType> request)
    {
        //Do Stuff Here
    }
}
Run Code Online (Sandbox Code Playgroud)

简明代码:

public class XService :
    IGenericService<MyType>
{
    GenericResponse<MyType> DoFoo(GenericRequest<MyType> request)
    {
        //Do Stuff Here
    }
}
Run Code Online (Sandbox Code Playgroud)

Web.config:
我不使用SVC文件,而是在Web.config中处理了这些信息:

<add factory="System.ServiceModel.Activation.ServiceHostFactory"
     relativeAddress="Services/X.svc"
     service="ABC.Server.Modules.X.XService"/>

<service name="ABC.Server.Modules.X.XService"
         behaviorConfiguration="StandardBehavior">
  <endpoint bindingConfiguration="StandardBinding"
            binding="basicHttpBinding"
            contract="?" />
</service>
Run Code Online (Sandbox Code Playgroud)

我如何在合同名称中加入实际工作?

generics wcf contract endpoint

0
推荐指数
1
解决办法
1557
查看次数

如何保护WPF项目中的连接字符串密码?

我正在开发客户端和服务器游戏应用程序.我正在使用Web服务(WCF).这样,客户端应用程序不会存储数据库的密码.它改为访问Web服务,因此无法破解密码.但是现在,如果我可以使用Entity Framework,我认为我可以更快地发展.但是我很久以前就试过了,我读到WCF与EntityFramework不兼容,因为有些属性无法序列化.

所以我想,如果我使用实体框架,我不能分成两个应用程序(客户端和服务器).或者我可以吗?

如果我只开发一个应用程序(不在客户端/服务器中拆分),那么有没有安全的方法可以不被黑客入侵.此应用程序将连接到数据库,但它需要密码.但我认为我无法将密码存储在客户端使用的同一应用程序中.我该怎么办?

也许我的想法很困惑,抱歉.请帮我.谢谢.

.net database wpf wcf entity-framework

0
推荐指数
1
解决办法
753
查看次数

我们可以在内联网上使用WCF吗?

我正在尝试使用WPF为大学构建一个小应用程序,它不是一个网络应用程序,我正在使用sql server 2008用于此目的,我很想知道WCF是否可以用于此目的,并且请让我们知道为什么以及为什么不为此目的使用WCF.

DB在包含所有类等的代码库项目中处理.

谢谢你的时间.

wcf

0
推荐指数
1
解决办法
601
查看次数