小编Lad*_*nka的帖子

使用WCF客户端的Java JAX-WS服务

是否可以使用JAX-WS创建WebService,然后使用这样的绑定由WCF客户端使用?

<bindings>
        <basicHttpBinding>
            <binding name="CaseObjectServicePortBinding" >
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="TransportWithMessageCredential">
                    <transport clientCredentialType="Certificate"/>
                    <message clientCredentialType="Certificate" />
                </security>
            </binding>

        </basicHttpBinding>
    </bindings>
Run Code Online (Sandbox Code Playgroud)

我现在创建了这样一个没有WSIT的服务,只是一个简单的服务,并且想要忽略传入SOAP消息中的"Security"头.但它失败了:

"无法为权限为'xxxxxxxxxx'的SSL/TLS建立安全通道."

如果我改变:

<security mode="TransportWithMessageCredential">
                    <transport clientCredentialType="Certificate"/>
                    <message clientCredentialType="Certificate" />
                </security>
Run Code Online (Sandbox Code Playgroud)

至:

<security mode="Transport">
                    <transport clientCredentialType="Certificate"/>
                    <message clientCredentialType="Certificate" />
                </security>
Run Code Online (Sandbox Code Playgroud)

一切都完美无瑕.有什么想法我做错了什么?

wcf ws-security web-services jax-ws

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

替换旧版DirectDraw代码

昨天我找到了多年前在C++,Win32 API和DirectDraw 7中开发的我的俄罗斯方块游戏的源代码.我尝试构建解决方案但没有任何成功,因为最近的DirectX SDK(2010年6月)不包括DDraw.h和DDraw.lib更多.

是否有任何推荐的方法(希望通过示例)将代码从DirectDraw升级到更新的API?或者我应该只安装旧的DirectX SDK?

c++ directx directdraw

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

如何在EF4实体上提取属性的数据库表和列名?

我正在为使用EF4进行数据访问层的应用程序编写审计组件.我能够非常轻松地确定哪些实体已被修改,并且通过ObjectStateEntry对象,我可以提取已修改的原始值,当前值,实体名称和属性名称,但我还想提取原始表格和SQL Server中使用的列名和列名(因为它们并不总是与模型的实体和属性名称匹配)

有谁知道这样做的好方法?它甚至可能吗?映射显然存储在MSL中,但我无法找到以编程方式访问这些映射的方法.

c# sql-server entity-framework entity-framework-4

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

使用Entity Framework Code First时,SQL Server Sequential Guid作为密钥

我想使用EF4将实体映射到具有顺序guid作为PK的表.根据这篇文章http://leedumond.com/blog/using-a-guid-as-an-entitykey-in-entity-framework-4/ EF4支持这个,但使用edmx映射.有没有办法在使用EF4 Code First时使用服务器生成的Guids,如果是,如何使用?

.net entity-framework ef-code-first entity-framework-4.1

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

首先在EF4.1代码中,如何在Web.config中覆盖ConnectionString名称

我正在创建一个多租户Asp.Net MVC 3 Web应用程序,并首先使用EF4.1代码进行数据库模型.

对于开发,我很高兴在App_Data中使用SqlServerCE,为了生产,这将转移到Sql Server 2008.

说我的情况下被称为"MyModels",默认情况下,代码首先查找名为Web.config中"MyModels"的连接字符串.这可以被告知使用App_Data中的文件或更改为访问SQL2008中的数据库.到目前为止都很好.

但由于多租户,我希望SqlServerCE文件名匹配租户的唯一ID(因此App_Data将具有"client_x.sdf","client_y.sdf"; Sql Server 2008将具有单独的数据库).我无法弄清楚如何指向这些不同的数据库.

我已经尝试从DbContext继承并提供连接字符串的MyModel(在Web.config中使用'占位符'conn字符串并用唯一的id替换"{clientId}"),我也尝试在其中设置连接字符串MyModels构造函数:

base.Database.Connection.ConnectionString = xxx;
Run Code Online (Sandbox Code Playgroud)

但这似乎永远不会奏效.我总是得到以下错误:

建立与SQL Server的连接时发生与网络相关或特定于实例的错误.服务器未找到或无法访问.验证实例名称是否正确,以及SQL Server是否配置为允许远程连接.(提供者:命名管道提供程序,错误:40 - 无法打开与SQL Server的连接)

(这表明它尚未"配置"使用SqlServerCE,因此尝试连接到Sql Server.我想!)

跟踪代码,此时尚未从Web.config中读取Database.Connection.ConnectionString,因此我无法搜索和替换它,并且可能会在管道中稍后被'占位符'conn字符串覆盖.

我认为这一定非常简单,我找不到'钩子'.有人可以帮忙吗?

c# asp.net entity-framework-4 ef-code-first asp.net-mvc-3

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

EF 4.1 RC EF CF中的多对多关系

我有两个具有多对多关系的实体,如下所示:

class author
{
  public int AuthorID{get;set;}
  public string Name{get;set;}
  public virtual ICollection<book> books{get;set;}
}
class book
{
  public int BookID{get;set;}
  public string Name{get;set;}
 public virtual ICollection<author> authors{get;set;}

}
Run Code Online (Sandbox Code Playgroud)

我有一个名为Bookauthor的中间表,定义如下:

  BookAuthor: int
  int AuthorID
  int BookID
Run Code Online (Sandbox Code Playgroud)

如何使用FluentAPI进行映射

谢谢!!

mapping many-to-many entity-framework fluent-interface entity-framework-4.1

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

使用kso​​ap2的WCF Web服务的Android - 错误SoapFault - faultcode:'a:ActionNotSupported'

我做了一个简单的项目,使用kso​​ap2调用wcf web服务.但是当它调用envelope.getResponse(); 它给错误说-----

"SoapFault - faultcode:'a:ActionNotSupported'faultstring:'由于EndpointDispatcher上的ContractFilter不匹配,无法在接收方处理带有Action'GetString'的消息.这可能是由于合同不匹配(发送方与接收方之间的操作不匹配)或发送方与接收方之间的绑定/安全性不匹配.检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息,传输,无).faultactor:'null'detail:null"

我在localhost中运行web服务.

请帮帮我一些

我指定的这个值是否正确,

private static final String SOAP_ACTION = “GetString”;
private static final String OPERATION_NAME = “GetString”;
private static final String WSDL_TARGET_NAMESPACE = “http://tempuri.org/”;
private static final String SOAP_ADDRESS = “http://10.0.2.2:14089/Service1.svc?wsdl”;
Run Code Online (Sandbox Code Playgroud)

wcf android ksoap2

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

EF 4.1代码优先SQL ce 4.0更新集合异常

我首先在SQL ce 4.0中使用EF 4.1代码

我有两节课

public class Customer
{
    public int ID { get; set; }

    public string CompanyName { get; set; }

    public List<ContactPerson> ContactPersons { get; set; }
}

public class ContactPerson
{
    public int ID { get; set; }

    public string Name { get; set; }

}
Run Code Online (Sandbox Code Playgroud)

和DbContext

public class MyDB : DbContext
{
    public DbSet<ContactPerson> ContactPersons { get; set; }

    public DbSet<Customer> Customers { get; set; }

    public MyDB()
    {
        this.Configuration.LazyLoadingEnabled = true;
    }

    protected override …
Run Code Online (Sandbox Code Playgroud)

ef-code-first sql-server-ce-4 entity-framework-4.1

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

将种子数据放在EF代码优先的OnModelCreating方法中是否可以接受?

我知道如何使用EF 4.3中的迁移API执行种子数据.我整晚都在玩那个.但是,我的最终目标是让我的项目达到用户可以从源代码控制中拉出它并按F5并且它们很好用,数据库,种子数据等等.

目前代码优先在新构建上构建数据库非常出色,但在我在包管理器控制台中执行Update-Database之前,不会插入种子数据.此时它运行种子方法并插入我的种子数据.

  1. 是否可以在OnModelCreating方法中执行此操作?
  2. 我还可以在这里利用AddOrUpdate扩展方法吗?
  3. 每按一次F5,这个种子数据会运行吗?如果是,我是否可以检测数据库是否已经创建,并且只在初始数据库创建时添加此种子数据?

c# entity-framework ef-code-first ef-migrations entity-framework-4.3

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

使用WCF对SOAP请求进行数字签名时指定#Body的引用URI

我正在使用WCF客户端与非WCF Web服务进行通信.

此Web服务要求SOAP消息的主体已签名,但是,我无法生成有效的SOAP请求.

我已经实现了一个继承自IClientMessageInspector的ClientMessageInspector,我在其中修改了BeforeSendRequest方法中的消息以添加XML数字签名.我使用SignedXML类来执行此操作.

我正在使用用于WSDL和SOAP的IBM Web服务验证工具来检查我的数字签名是否经过验证.

我的问题是,当我在Reference URI中指定一个完整的命名空间引用时,我正在使用的IBM工具说我有一个有效的签名.从XML数字签名规范,我应该能够引用属性,没有命名空间,但是,当我这样做时,我没有得到有效的数字签名.

这是我正在生成的SOAP请求,我的工具说它具有有效的签名,但Web服务不喜欢它:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" 
            xmlns:s="http://www.w3.org/2003/05/soap-envelope" 
            xmlns:soapsec="http://schemas.xmlsoap.org/soap/security/2000-12" 
            xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <s:Header>
    <soapsec:Signature>
      <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
        <SignedInfo>
          <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
          <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
          <Reference URI="http://schemas.xmlsoap.org/soap/security/2000-12#Body">
            <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
            <DigestValue>4mt5wluUTu5tpR2d5UemVSLvqTs=</DigestValue>
          </Reference>
        </SignedInfo>
        <SignatureValue>UZ7HzfE3GxIY9hg...</SignatureValue>
        <KeyInfo>
          <X509Data>
            <X509Certificate>MIIEkTCCA3mgAwIBAgIQCu...</X509Certificate>
          </X509Data>
          <KeyValue>
            <RSAKeyValue>
              <Modulus>0C3e9HDx5Yq6FLUxIgjJ...</Modulus>
              <Exponent>AQAB</Exponent>
            </RSAKeyValue>
          </KeyValue>
        </KeyInfo>
      </Signature>
    </soapsec:Signature>
  </s:Header>
  <s:Body soapsec:id="Body">
    .... SOAP Body Here ...
  </s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)

这是我想要生成的SOAP请求,但我的工具说这有一个无效的签名,Web服务也告诉我签名无效:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" 
            xmlns:s="http://www.w3.org/2003/05/soap-envelope" 
            xmlns:soapsec="http://schemas.xmlsoap.org/soap/security/2000-12" 
            xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <s:Header>
    <soapsec:Signature>
      <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
        <SignedInfo>
          <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
          <SignatureMethod …
Run Code Online (Sandbox Code Playgroud)

c# wcf soap

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