2

在几台运行 Windows 2000 的客户端 PC 上,我只能使用 .Net 2.0。(它们运行的​​其他专有软件在任何其他操作系统上都会失败)

我希望能够从一个 .net DLL 访问一些 web 服务,该 DLL 是从一个 VB6 DLL 调用的,该 DLL 由(等待它)调用......一个 COBOL 应用程序。(我完全清楚这是一个次优环境)。我的理解是在这种情况下我无法访问配置文件。我还希望能够在环境之间切换。

我希望能够创建 2.0 网络服务并在代码中对其进行配置。我一直在通过谷歌搜索,但我能找到的只是 WCF 服务示例。

这可能吗?你有代码吗?

4

1 回答 1

3

事实证明,Framework 2.0 Web 服务(在 Visual Studio 2010 中)甚至不需要配置文件。当您创建 Web 引用时,它会烘焙所有内容。您可以在 Web 配置中注释掉整个 system.serviceModel 部分,它会运行良好(使用默认值)。然后,您可以设置 URL。

   Friend Shared Function CreateContractsServiceInstance(UseLive As Boolean) As ContractsService.ContractsWebService

    Dim client As New ContractsService.ContractsWebService()

    If UseLive Then
        client.Url = "http://xxx/livecontracting/WebService.asmx"
    Else
        client.Url = "http://xxx/contractstest/WebService.asmx"
    End If

    Return client

End Function
于 2012-11-15T15:12:48.880 回答