首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我正在尝试设置一个通过MsmqIntegrationBinding调用的WCF服务,但我收到一个错误

我正在尝试设置一个通过MsmqIntegrationBinding调用的WCF服务,但我收到一个错误
EN

Stack Overflow用户
提问于 2011-04-23 02:44:03
回答 1查看 1.3K关注 0票数 5

System.InvalidOperationException: MsmqIntegrationBinding验证失败。无法启动该服务。MsmqIntegrationBinding绑定不支持服务操作的方法签名。

我从下面的示例Here开始工作,我更改的唯一设置是我需要使用ActiveX序列化格式。

接口

代码语言:javascript
复制
namespace MQTest
{
    //MSMQIntegrationBinding
    [ServiceContract]
    public interface IMQService
    {
        [OperationContract(IsOneWay = true, Action = "*")]
        void GetData(string value);
    }
}

服务

代码语言:javascript
复制
 public class MQService : IMQService
    {
        public static void Main()
        {
            // Get base address from appsettings in configuration.
            Uri baseAddress = new Uri("http://localhost:8000/Test/Service");

            // Create a ServiceHost for the CalculatorService type and provide the base address.
            using (ServiceHost serviceHost = new ServiceHost(typeof (IMQService), baseAddress))
            {
                // Open the ServiceHostBase to create listeners and start listening for messages.
                serviceHost.Open();

                // The service can now be accessed.
                Console.WriteLine("The service is ready.");
                Console.WriteLine("The service is running in the following account: {0}",
                                  WindowsIdentity.GetCurrent().Name);
                Console.WriteLine("Press <ENTER> to terminate service.");
                Console.WriteLine();
                Console.ReadLine();

                // Close the ServiceHostBase to shutdown the service.
                serviceHost.Close();
            }
        }
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public void GetData(string value)
        {
            Console.WriteLine(value);
        }
    }

App.config

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <services>
            <service name="MQTest.MQService">
                <endpoint address="msmq.formatname:DIRECT=OS:.\private$\outbound_adt_a08"
                                        binding="msmqIntegrationBinding"
                          bindingConfiguration="OrderProcessorBinding"
                          contract="MQTest.IMQService">
                </endpoint>
            </service>
        </services>

        <bindings>
            <msmqIntegrationBinding>
                <binding name="OrderProcessorBinding" serializationFormat="ActiveX">
                    <security mode="None" />
                </binding>
            </msmqIntegrationBinding>
        </bindings>
    </system.serviceModel >
</configuration>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-04-23 03:07:08

该接口看起来必须接受MsmqMessage

我改变了我的界面,现在它可以工作了。也许这对其他人有帮助。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5758815

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档