标签: wshttpbinding

在silverlight中支持wshttpbinding 4

silverlight 4 beta是否支持wshttpbinding(wcf)?如果没有,它是否会在稳定版本中得到支持?

silverlight wcf wshttpbinding silverlight-4.0

6
推荐指数
1
解决办法
5365
查看次数

如何使用wsHttpBidning和仅传输安全性启用WCF会话

我目前使用basicHttpBindings和SSL启用了WCF服务.但现在我需要启用wcf会话(而不是asp会话)所以我将服务转移到wsHttpBidnings但是会话未启用

我已经设定

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
Run Code Online (Sandbox Code Playgroud)

但是当我设定的时候

SessionMode=SessionMode.Required
Run Code Online (Sandbox Code Playgroud)

在服务合同上,它说

合同需要Session,但Binding'WSHttpBinding'不支持它,或者没有正确配置以支持它.

以下是WSHttpBinding的定义

<wsHttpBinding>
    <binding name="wsHttpBinding">
      <readerQuotas maxStringContentLength="10240" />
      <reliableSession enabled="false" />
      <security mode="Transport">
        <transport clientCredentialType="None">
          <extendedProtectionPolicy policyEnforcement="Never" />
        </transport>
      </security>
    </binding>
  </wsHttpBinding>
Run Code Online (Sandbox Code Playgroud)

请在这件事上给予我帮助

.net wcf wshttpbinding wcf-security wcf-sessions

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

如何读取app.config中定义的属性的值?

我有一个app.config文件,其形式为:

<?xml version="1.0" encoding="utf-8" ?>
  <configuration>
    <system.serviceModel>
      <client>
        <endpoint address="http://something.com"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileTransfer"
        contract="ABC" name="XXX" />
        <endpoint address="http://something2.com"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileTransfer"
        contract="ABC2" name="YYY" />
      </client>
    </system.serviceModel>
  </configuration>
Run Code Online (Sandbox Code Playgroud)

我想读取节点端点的属性"address"的值,其名称为"XXX".请告诉我该怎么做!

(继续讨论与marc_s讨论.抱歉把文本放在这里,因为评论不允许格式化代码)@marc_s:我使用下面的代码来读取上面的文件,但它显示clientSection.Endpoints有0个成员(Count = 0 ).请帮忙!

public MainWindow()
    {
        var exeFile = Environment.GetCommandLineArgs()[0];
        var configFile = String.Format("{0}.config", exeFile);
        var config = ConfigurationManager.OpenExeConfiguration(configFile);
        var wcfSection = ServiceModelSectionGroup.GetSectionGroup(config);
        var clientSection = wcfSection.Client;
        foreach (ChannelEndpointElement endpointElement in clientSection.Endpoints)
        {
            if (endpointElement.Name == "XXX")
            {
                var addr = endpointElement.Address.ToString();
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

c# xml configuration wshttpbinding

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

使用WSHttpBinding的WCF和Java Interop,

我正在尝试使用Java客户端使用简单的WCF应用程序.服务使用WSHttpBinding公开了一些简单的操作,它完美地完成了.

现在,由于某种原因(可能是由于Java端的WS-*规范不完整),似乎无法为远程系统上托管的此WCF服务生成Java客户端.

但是,当与basicHttpBinding一起使用时,一切正常.

如果您成功使用或已经实现了可与Java/Non WCF客户端互操作的WCF(wsHttpBinding)?

java wcf client wshttpbinding

6
推荐指数
1
解决办法
2024
查看次数

.NetStandard或.NET Core中的WSHttpBinding

我想将NMVS协议集成到我的应用程序中,该应用程序提供用于测试的wsdl文件,这些文件是在.net框架库中编写的示例代码。

我想在.netstandard,.netcore或UWP应用程序中对其进行测试,但wsdl文件仅支持“ WSHttpBinding”,而.netstandard,.net core和UWP不支持。

 <wsdl:binding name="WSHttpBinding_ISinglePackServices" type="ns:ISinglePackServices">



WSHttpBinding binding = new WSHttpBinding();
 binding.Security.Mode =  SecurityMode.Transport;
 binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
Run Code Online (Sandbox Code Playgroud)

我使用basichttpbinding,但出现错误,提示“内容类型为application / soap + xml;响应消息的charset = UTF-8与绑定的内容类型不匹配(text / xml; charset = utf-8)。 ”

还有什么其他方法可以解决此问题?

感谢Imrankhan

wshttpbinding uwp asp.net-core .net-standard

6
推荐指数
1
解决办法
2260
查看次数

不了解SOAP标头操作

我正在尝试在C#中使用Web服务。每当我尝试从Web服务类调用该函数时,都会收到“不理解SOAP标头操作”的信息。我在项目中添加了指向Web服务的Web参考[not service reference]。采取了以下步骤来添加Web参考

1)右键单击项目->添加WebReference

当我在Web浏览器中检查Web服务时,我在标题中找到了这个

<wsdl:definitions name="MyService" targetNamespace="http://tempuri.org/">
    <wsp:Policy wsu:Id="WSHttpBinding_ICAIService_policy">
        <wsp:ExactlyOne><wsp:All><sp:TransportBinding>
    <wsp:Policy>
Run Code Online (Sandbox Code Playgroud)

我已完成以下代码来调用Web服务功能

WebStruct webS = new WebStruct();
webS.Name = "Peter";
webS.ID = 22;

webS.Find(webS);
Run Code Online (Sandbox Code Playgroud)

c# web-services asmx wshttpbinding webhttpbinding

5
推荐指数
2
解决办法
2万
查看次数

Roles.IsUserInRole()使用wsHttpBinding和MVC 4无法在WCF中工作

我有以下测试设置,所有工作:

-WCF应用程序运行MathService.svc,设置为使用SimpleMembershipProvider

-MVC 4 Internet App使用默认的SimpleMembershipProvider

- 会员资格是:

  • 3角色:'调试','管理员'和'编辑'
  • 2用户:角色调试和管理员中的"调试"(ya,角色调试中的用户调试)
  • 角色管理员中的"管理员"

- 证书,据我所知,我可以使用wshttp连接到服务

服务方法代码.

//[PrincipalPermission(SecurityAction.Demand, Role = "Debug")]
public string Add(double A, double B)
{
    OperationContext oc = OperationContext.Current;
    ServiceSecurityContext ssc = oc.ServiceSecurityContext;
    string cltName = ssc.PrimaryIdentity.Name;   //cltName = "Debug"
    var Rs = Roles.GetAllRoles(); //returns: 'Debug', 'Administrator', 'Editor' => OK
    var dUsers = Roles.GetUsersInRole("Debug");  // 'Debug' => Expected
    var aUsers = Roles.GetUsersInRole("Administrator"); // 'Debug', 'Admin' => expected
    try
    {
        var a = Roles.GetRolesForUser(cltName); //this fails 
        var b = Roles.IsUserInRole(cltName, "Debug"); …
Run Code Online (Sandbox Code Playgroud)

wcf roles wshttpbinding simplemembership

5
推荐指数
1
解决办法
1493
查看次数

将标头添加到WCF RequestSecurityToken消息

我正在尝试设置将使用WSHttpBinding进行通信的客户端(Web应用程序)和服务(WCF服务).看来为了使用这种绑定,客户端发送初步消息来设置频道.

在客户端和服务之间存在一个服务总线,它在自定义头上进行路由.使用BasicHttpBinding安全性时,该消息没有问题.

我的问题是:有没有办法在初步的RequestSecurityToken消息中添加相同的自定义标头?

先感谢您.

c# wcf ws-security wshttpbinding

5
推荐指数
1
解决办法
507
查看次数

使用Powershell调用WCF服务方法

我有一个使用wsHttpBinding和消息安全性以及clientcredentialtype作为Windows的WCF服务,该服务有一个简单的方法

[OperationContract]
string SayHello();

public string SayHello()
    {
        return "HELLO";
    } 

<wsHttpBinding>
    <binding name="WSHttpBinding">          
      <security mode="Message">
        <message clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
Run Code Online (Sandbox Code Playgroud)

我试图在powershell(version> = 2)上执行以下操作,但出现以下错误

$wshttpbinding= New-WebServiceProxy -uri http://localhost:52871/Service.svc -Credential DOMAIN\gop

PS> $wshttpbinding.SayHello.Invoke()
    Exception calling "SayHello" with "0" argument(s): "The operation has timed out"
    At line:1 char:1
    + $wshttpbinding.SayHello.Invoke()
    + ~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException
Run Code Online (Sandbox Code Playgroud)

但是,当我将绑定更改为使用basicHttpBinding时,它可以正常工作

<basicHttpBinding>
          <binding name="basicconfig" 
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows" />
      </security>
    </binding>
</basicHttpBinding>

$basichttpbinding= New-WebServiceProxy -uri http://localhost:52871/Service.svc -Credential DOMAIN\gop …
Run Code Online (Sandbox Code Playgroud)

c# powershell wcf wshttpbinding

5
推荐指数
1
解决办法
6682
查看次数

连接切断后如何在WCF可靠消息传递中从服务器接收响应

所以我创建了Client/Server WCF.我想要的是当我从这个客户端向服务器发送消息并且因任何原因切断连接时,客户端关闭,例如,当客户端再次可用时,该客户端如何获得响应?

是否可以在客户端和服务器之间设置会话等?

我的客户代码是:

private static void Main(string[] args)
{
    var client = new FlipCaseServiceClient("ReliableMessageService");
    var sd = new StringData { FirstName = "Turgut", LastName = "Kançeltik" };

    var fullName = client.GetFullName(ref sd);

    Console.WriteLine(fullName);
}
Run Code Online (Sandbox Code Playgroud)

我的服务器代码是:

[DeliveryRequirements(RequireOrderedDelivery = true)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Single)]
public class FlipCaseService : IFlipCaseService
{
    public string GetFullName(ref StringData stringData)
    {
        var fullName = $"{stringData.FirstName} {stringData.LastName}";

        stringData.FullName = fullName;
        return fullName;
    }
}
Run Code Online (Sandbox Code Playgroud)

和服务器配置摘要:

<service behaviorConfiguration="ServiceBehaviorMetaData" name="FlipCaseService.FlipCaseService" >
  <endpoint name="ReliableMessageService" address="flipcase/wsAddress" binding="wsHttpBinding" bindingConfiguration="BindingReliableMessaging" contract="FlipCaseService.IFlipCaseService" …
Run Code Online (Sandbox Code Playgroud)

c# wcf ws-reliablemessaging wshttpbinding wcf-wshttpbinding

5
推荐指数
1
解决办法
659
查看次数