Biztalk在c#中接收位置

时间:2014-02-25 03:07:16

标签: c# biztalk biztalk-2010

我使用c#配置了一个接收端口。 下面是代码,一切都很好。 但我需要配置身份验证选项卡并提供USERNAME和PASSWORD的详细信息。 任何人都可以指导我。

ReceivePort myreceivePort = app.AddNewReceivePort(false);

        //Note that if you dont set the name property for the receieve port, 
        //it will create a new receive location and add it to the receive       //port.
        myreceivePort.Name = "MyPort";


        //Create a new receive location and add it to the receive port
        ReceiveLocation myreceiveLocation = myreceivePort.AddNewReceiveLocation();


        foreach(ReceiveHandler handler in root.ReceiveHandlers)
        {
           if(handler.TransportType.Name == "FILE")
           {
              myreceiveLocation.ReceiveHandler = handler;
              break;
           }
        }

        //Associate a transport protocol and URI with the receive location.
        foreach (ProtocolType protocol in root.ProtocolTypes)
        {
           if(protocol.Name == "FILE")
           {
              myreceiveLocation.TransportType =  protocol;

              break;
           }
        }
        myreceiveLocation.CustomData
        // new BizTalk application

        myreceiveLocation.Address = "C:\\test\\*.txt";
        //Assign the first receive pipeline found to process the message.
        foreach(Pipeline pipeline in root.Pipelines)
        {
           if(pipeline.Type == PipelineType.Receive)
           {
              myreceiveLocation.ReceivePipeline = pipeline;
              break;
           }
        }

        //Enable the receive location.
        myreceiveLocation.Enable = true;
        myreceiveLocation.FragmentMessages = Fragmentation.Yes;//optional property
        myreceiveLocation.ServiceWindowEnabled = false; //optional pr

1 个答案:

答案 0 :(得分:1)

身份验证保存在属性Data中,该属性包含XML CustomProps,其中包含两个元素Username和Password。

注意:1)密码也必须更改

<Password vt=\"8\">PASSWORD</Password>

2)增加了换行符以提高可读性。

<CustomProps>
   <FileMask vt=\"8\">*.xml</FileMask>
   <RemoveReceivedFileMaxInterval vt=\"19\">300000</RemoveReceivedFileMaxInterval>
    <Username vt=\"8\">USER</Username>
    <RemoveReceivedFileRetryCount vt=\"19\">5</RemoveReceivedFileRetryCount>
    <RenameReceivedFiles vt=\"11\">0</RenameReceivedFiles>
    <RemoveReceivedFileDelay vt=\"19\">10</RemoveReceivedFileDelay>
    <FileNetFailRetryCount vt=\"19\">5</FileNetFailRetryCount>
    <Password vt=\"1\" />
    <PollingInterval vt=\"19\">60000</PollingInterval>
    <BatchSize vt=\"19\">20</BatchSize>
    <FileNetFailRetryInt vt=\"19\">5</FileNetFailRetryInt>
    <BatchSizeInBytes vt=\"19\">102400</BatchSizeInBytes>
</CustomProps>
相关问题