在 Windows 窗体应用程序中包含 ASP Web 服务项目

发布于 2024-08-03 01:26:51 字数 174 浏览 3 评论 0原文

我有一个 Web 服务,我想将其作为项目引用包含在 Windows 窗体应用程序中。 (该应用程序将在非联网硬件上运行。)我可以简单地将所需的 *.vb 文件复制到我的表单项目中,但我不想分叉代码库。

将 ASP 项目包含在 Windows 窗体解决方案中并不困难。但是,我不知道如何在我的表单代码中引用它。这可能吗?

I have a web service that I'd like to include as a project reference inside a windows forms application. (The application will be running on non-networked hardware.) I could simply copy the *.vb files I need into my forms project, but I'd rather not fork the code base.

It wasn't hard to include the ASP project in the windows forms solution. However, I can't figure out how to reference it in my forms code. Is this even possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

桃气十足 2024-08-10 01:26:51

假设您不尝试调用 Web 服务,而只是共享实现细节,则可以将公共代码移至两个项目共享的程序集中,甚至只需将代码文件链接到第二个项目中,而不是复制它们那里。

要添加链接文件:

  1. 右键单击您的项目,
  2. 选择“添加”->“现有项目...
  3. 选择要添加的文件
  4. 单击“添加”按钮边缘的小箭头,然后选择“添加为链接”

Assuming that you're not trying to call the web service, and just share the implementation details, you could move the common code into an assembly shared by the two projects, or even just link the code files into your second project rather than copying them there.

To add linked files:

  1. Right click on your project
  2. Select Add -> Existing Item...
  3. Select the file(s) you want to add
  4. Click the little arrow on the edge of the Add button, and select "Add As Link"
救赎№ 2024-08-10 01:26:51

您必须包含该项目,然后设置 Web 服务的开发实例。

然后,您可以将 Web 引用添加到表单应用程序中的服务开发实例。确保使用对 Web 服务的动态引用(应将服务的 URL 存储在 app.config 文件中)。这将使您能够稍后更改 URL。

准备好部署解决方案后,您可以在生产硬件上安装 Web 服务...然后将 Web 服务设置为在 IIS 中运行(仅适用于本地主机)并将 Forms 应用程序的 ap.config 更新为匹配服务的本地 URL。

You'll have to include the project and then set up a development instance of the web service.

You can then add a Web Reference to your development instance of the service in your forms app. Make sure you use a dynamic reference to the web service (should store the URL of the service in the app.config file). That'll give you the ability to change the URL later.

Once you're ready to deploy your solution, you can install the web service on the production hardware...and then set up the web service to run in IIS (just for localhost) and update the ap.config of your Forms app to match the service's local URL.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文