简体   繁体   English

端点与Windows沉浸式项目的版本1不兼容

[英]Endpoint is not compatible with version 1 of windows immersive project

For some reason I have error generating code for a wcf service using "Add service reference" wizard. 出于某种原因,我使用“添加服务引用”向导为wcf服务生成代码时出错。

Custom tool warning: No endpoints compatible with version 1 of windows immersive project were found.    C:\work\test_projects\CirMetro\Service References\SvcProxy\Reference.svcmap 1   1   CirMetro

Do you guys know how to fix it ? 你们知道怎么解决吗?

My sample WCF service is braindead simple. 我的示例WCF服务很简单。 Here is source code: 这是源代码:

static void Main()
{
    UiWcfSession.OnInitialize += ClientInitialize;

    var baseAddresses = new Uri("net.tcp://localhost:9000/");

    var host = new ServiceHost(typeof(UiWcfSession), baseAddresses);

    var reliableSession = new ReliableSessionBindingElement { Ordered = true, InactivityTimeout = new TimeSpan(24, 20, 31, 23) };
    var binding =
        new CustomBinding(reliableSession, new TcpTransportBindingElement()) { ReceiveTimeout = TimeSpan.MaxValue };

    host.AddServiceEndpoint(typeof(IClientFulfillmentPipeService), binding, "svc");

    var metadataBehavior = new ServiceMetadataBehavior();
    host.Description.Behaviors.Add(metadataBehavior);
    var mexBinding = MetadataExchangeBindings.CreateMexTcpBinding();
    host.AddServiceEndpoint(typeof(IMetadataExchange), mexBinding, "mex");

    host.Open();

    Thread.CurrentThread.Join();
}

private static void ClientInitialize(int uiprocessid, string key)
{
    Debug.WriteLine("ClientInitialize");
}

I figured it out. 我想到了。

It's unfortunate that we have to decompile sources of Visual Studio to find out what works in Metro instead of referring to non-existent documentation :-) 不幸的是,我们必须反编译Visual Studio的源代码,以找出在Metro中有效的内容,而不是引用不存在的文档:-)

In short I can't use ReliableSession. 总之,我不能使用ReliableSession。

If you want more details C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\\PrivateAssemblies\\Microsoft.VisualStudio.ServiceReference.Platforms.dll contains function which check what is supported. 如果需要更多详细信息C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\\PrivateAssemblies\\Microsoft.VisualStudio.ServiceReference.Platforms.dll包含检查支持的功能。

private static bool IsBindingSupported(Binding binding)
{
    if ((!(binding is BasicHttpBinding) && !(binding is CustomBinding)) && (!(binding is WSHttpBinding) && !(binding is NetTcpBinding)))
    {
        return false;
    }
    if (binding is WSHttpBinding)
    {
        if (((WSHttpBinding) binding).ReliableSession.Enabled)
        {
            return false;
        }
        if (((WSHttpBinding) binding).TransactionFlow)
        {
            return false;
        }
        if (((WSHttpBinding) binding).MessageEncoding != WSMessageEncoding.Text)
        {
            return false;
        }
    }
    if (binding is NetTcpBinding)
    {
        if (((NetTcpBinding) binding).ReliableSession.Enabled)
        {
            return false;
        }
        if (((NetTcpBinding) binding).TransactionFlow)
        {
            return false;
        }
    }
    foreach (BindingElement element in binding.CreateBindingElements())
    {
        if (element is TransportBindingElement)
        {
            if ((!(element is HttpTransportBindingElement) && (!(element is HttpsTransportBindingElement) || (element as HttpsTransportBindingElement).RequireClientCertificate)) && !(element is TcpTransportBindingElement))
            {
                return false;
            }
        }
        else if (element is MessageEncodingBindingElement)
        {
            if (!(element is BinaryMessageEncodingBindingElement) || (((BinaryMessageEncodingBindingElement) element).MessageVersion != MessageVersion.Soap12WSAddressing10))
            {
                if (element is TextMessageEncodingBindingElement)
                {
                    if ((((TextMessageEncodingBindingElement) element).MessageVersion != MessageVersion.Soap11) && (((TextMessageEncodingBindingElement) element).MessageVersion != MessageVersion.Soap12WSAddressing10))
                    {
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
        }
        else if (element is SecurityBindingElement)
        {
            if (!(element is TransportSecurityBindingElement))
            {
                return false;
            }
            TransportSecurityBindingElement element2 = (TransportSecurityBindingElement) element;
            if (!ValidateUserNamePasswordSecurityBindingElement(element2))
            {
                if (((((element2.EndpointSupportingTokenParameters.Endorsing.Count == 1) && (element2.EndpointSupportingTokenParameters.Signed.Count == 0)) && ((element2.EndpointSupportingTokenParameters.SignedEncrypted.Count == 0) && (element2.EndpointSupportingTokenParameters.SignedEndorsing.Count == 0))) && ((element2.EndpointSupportingTokenParameters.Endorsing[0] is SecureConversationSecurityTokenParameters) && ((element2.MessageSecurityVersion == MessageSecurityVersion.WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10) || (element2.MessageSecurityVersion == MessageSecurityVersion.WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10)))) && ((element2.IncludeTimestamp && (element2.DefaultAlgorithmSuite == SecurityAlgorithmSuite.Default)) && (element2.SecurityHeaderLayout == SecurityHeaderLayout.Strict)))
                {
                    SecureConversationSecurityTokenParameters parameters = (SecureConversationSecurityTokenParameters) element2.EndpointSupportingTokenParameters.Endorsing[0];
                    if (parameters.RequireDerivedKeys || !(parameters.BootstrapSecurityBindingElement is TransportSecurityBindingElement))
                    {
                        return false;
                    }
                    TransportSecurityBindingElement bootstrapSecurityBindingElement = (TransportSecurityBindingElement) parameters.BootstrapSecurityBindingElement;
                    if (!ValidateUserNamePasswordSecurityBindingElement(bootstrapSecurityBindingElement))
                    {
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
        }
        else if ((!(element is SslStreamSecurityBindingElement) || (element as SslStreamSecurityBindingElement).RequireClientCertificate) && !(element is WindowsStreamSecurityBindingElement))
        {
            if (!(element is TransactionFlowBindingElement))
            {
                return false;
            }
            if ((!(binding is WSHttpBinding) || ((WSHttpBinding) binding).TransactionFlow) && (!(binding is NetTcpBinding) || ((NetTcpBinding) binding).TransactionFlow))
            {
                return false;
            }
        }
    }
    return true;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows Phone项目的代码分析设置不兼容 - Code Analysis settings for windows phone project not compatible 项目与 uap10.0.16299 (UAP,Version=v10.0.16299) 不兼容 - Project is not compatible with uap10.0.16299 (UAP,Version=v10.0.16299) 正确的方法来添加对C#项目的引用,使它们与版本控制兼容 - Correct way to add references to C# project such that they are compatible with version control 移动按钮在C#windows 8沉浸式应用程序中 - moving buttons in C# windows 8 immersive application 如果版本不兼容,如何以编程方式强制关闭Windows Phone应用 - How to force close windows phone app programmatically if version is not compatible Visual Studio生成错误“此版本的NuGet.exe与您正在运行的Windows版本不兼容。” - Visual Studio build error “This version of NuGet.exe is not compatible with the version of Windows you're running.” 该提供程序与Oracle版本不兼容 - The provider is not compatible with the version of Oracle Project MyAzureFunc与netstandard2.0>(.NETStandard,Version = v2.0)不兼容 - Project MyAzureFunc is not compatible with netstandard2.0 > (.NETStandard,Version=v2.0) WSDL是否与Windows Phone 8兼容? - Is WSDL compatible with Windows Phone 8? Kubernetes 找不到兼容版本(dotnet) - Kubernetes no compatible version found (dotnet)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM