gpt4 book ai didi

web-services - Azure 网站与 Azure 服务的连接

转载 作者:行者123 更新时间:2023-12-02 06:50:44 25 4
gpt4 key购买 nike

我有一个 asp.net MVC 网站,它通过 Web 服务与 SQL 数据库进行通信。在 IIS 中设置后一切正常。我最近通过将网站和 Web 服务发布为 Web 应用程序,将整个解决方案迁移到 Azure。在 IIS 下,网站的 web.config 使用以下方式连接到服务端点:

<client>
<endpoint address="http://localhost:7070/Services.svc"binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITrain" contract="ServiceReference1.ITrain" name="BasicHttpBinding_ITrain"/>
</client>

在 Azure 中,我已将其更改为:

<client>
<endpoint address="http://<sitename>.azurewebsites.net/Services.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITrain" contract="ServiceReference1.ITrain" name="BasicHttpBinding_ITrain" />
</client>

这两个网络应用程序无法通信。我应该采取不同的做法还是问题出在其他地方?

最佳答案

如果您说 WSDL 看起来不错,那么我建议的下一件事就是构建一个新的简单控制台应用程序来尝试与之对话。使用解决方案资源管理器中的“添加服务引用”并提供 http://.azurewebsites.net/Services.svc URL。如果“添加服务引用”出现问题,则表示存在某种 WSDL 错误。但如果成功,您的项目将自动生成代码来与该服务通信。 https://msdn.microsoft.com/en-us/library/bb386386.aspx 处的示例走过这个。

如果控制台应用成功与服务通信,请仔细查看生成的 app.config,看看它是否与您现有的配置文件不同。

罗恩·凯恩 MSFT

关于web-services - Azure 网站与 Azure 服务的连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30872975/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com