简体   繁体   English

Azure 网站连接到 Azure 服务

[英]Azure website connection to Azure Service

I have a asp.net MVC website which communicates to a SQL database through a web service.我有一个通过 Web 服务与 SQL 数据库通信的 asp.net MVC 网站。 When set up in IIS it all works fine.在 IIS 中设置时,一切正常。 I recently migrated the whole solution to Azure by publishing the Website and webservice as Web Apps.我最近通过将网站和 web 服务发布为 Web 应用程序将整个解决方案迁移到 Azure。 Under IIS the web.config of the website connects to the service endpoint using:在 IIS 下,网站的 web.config 使用以下方法连接到服务端点:

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

In Azure i have changed this to:在 Azure 中,我已将其更改为:

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

The two web apps do not communicate.这两个 Web 应用程序不通信。 Should i be doing something differently or does the problem lie somewhere else?我应该做些不同的事情还是问题出在其他地方?

If you say the WSDL looked okay, the next thing I would recommend would be building a new simple Console app to try to talk to it.如果您说 WSDL 看起来不错,那么我建议的下一件事情是构建一个新的简单控制台应用程序来尝试与之对话。 Use Add Service Reference in the Solution Explorer and provide the http://.azurewebsites.net/Services.svc URL.在解决方案资源管理器中使用添加服务引用并提供 http://.azurewebsites.net/Services.svc URL。 If Add Service Reference has a problem, you have some kind of WSDL error.如果 Add Service Reference 有问题,那么您就会遇到某种 WSDL 错误。 But if it succeeds, your project will have auto-generated code to talk to that service.但如果成功,您的项目将具有自动生成的代码来与该服务对话。 The example at https://msdn.microsoft.com/en-us/library/bb386386.aspx walks through this. https://msdn.microsoft.com/en-us/library/bb386386.aspx 上的示例说明了这一点。

If the Console app succeeds in talking to the service, look very carefully at the generated app.config to see if it differs from your existing config files.如果控制台应用程序成功与服务通信,请仔细查看生成的 app.config,看看它是否与您现有的配置文件不同。

Ron Cain MSFT罗恩凯恩 MSFT

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM