动态网络引用网址

时间:2017-07-12 11:58:45

标签: c# soap ssis wsdl

我正在使用SSIS C#脚本中的SAOP API。 我的问题是如何从变量中改变我的Web Reference?

我在网络参考设置中找到了此选项:enter image description here

但我的问题是如何在C#脚本中更改此值?

我尝试了以下操作,但是我收到了错误:

 PS.Url = "http://" + Variables.WebServiceURL + "/WebService/services/PlanningService";

错误消息:

at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)    在System.Net.HttpWebRequest.GetRequestStream()    在System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName,Object []参数)    at SC_15f094dba1c3453e812875c8714e03b4.PlanningService.PlanningService.getPlanningAreas()in c:\ Users \\ AppData \ Local \ Temp \ vsta \ 802c7440ec9144df97b2df214844351c \ Web References \ PlanningService \ Reference.cs:line 460    at ScriptMain.CreateNewOutputRows()in c:\ Users \\ AppData \ Local \ Temp \ vsta \ 802c7440ec9144df97b2df214844351c \ main.cs:line 127    at UserComponent.PrimeOutput(Int32输出,Int32 [] OutputIDs,PipelineBuffer [] Buffers,OutputNameMap OutputMap)在c:\ Users \\ AppData \ Local \ Temp \ vsta \ 802c7440ec9144df97b2df214844351c \ ComponentWrapper.cs:第49行    在Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32输出,Int32 [] outputIDs,PipelineBuffer []缓冲区)

1 个答案:

答案 0 :(得分:0)

正如@Jonesopolis评论的那样,我设法通过一个来自SSIS的参数通过Url字段更改引用。

所以这有效:

PS.Url = "http://" + Variables.WebServiceURL + "/WebService/services/PlanningService";

Web服务器已关闭,这就是我收到错误的原因。