【发布时间】:2019-01-31 10:11:24
【问题描述】:
我使用“云服务 >> WCF Web 角色”创建了一个 WCF 服务(如下图所示)。 (这只是我一直在进行的一个测试练习,以确保 WCF 可以托管在 Azure 应用服务中,并通过使用 C# 创建的外部应用进行连接。)
[在此处输入图片描述]1
我的 WebConfig 如下:
<?xml version="1.0"?>
<configuration>
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="AzureDiagnostics">
<!--<filter type="" />-->
</add>
</listeners>
</trace>
</system.diagnostics>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<authentication mode="None"/>
</system.web>
<system.serviceModel>
<!--DECLARE BINDINGS-->
<bindings>
<wsHttpBinding>
<binding name="CustomBinding"
openTimeout="00:20:00"
receiveTimeout="00:20:00" closeTimeout="00:20:00"
sendTimeout="00:20:00" >
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message algorithmSuite="Default" clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<!--DECLARE BEHAVIOUR-->
<behaviors>
<serviceBehaviors>
<behavior name="CustomBehaviour">
<!-- To avoid disclosing metadata information, set the value below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<!--CREATE SERVICE WITH ENDPOINTS-->
<services>
<!-- Service For Main Implementation-->
<service name="DolphinBimUserRegistration.Service1" behaviorConfiguration="CustomBehaviour">
<endpoint address="DBWsHttp" binding="wsHttpBinding" bindingConfiguration="CustomBinding" contract="DBIMInterface.IDBIMService"/>
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
将 WCF 服务发布到 Azure 应用服务后,我可以创建服务引用。到这里为止一切都很完美..
在调试过程中,当我尝试调用 WCF 服务中的基本“GetData”函数时,它频繁地请求用户凭据(如下图所示)。
我需要找到一种无需手动输入凭据即可访问我的 azure Web 应用服务的方法。我一直试图解决这个问题很长时间。似乎没有任何效果。
- 我在某处读到,我们可以输入通过在 Azure 中使用“获取发布配置文件”获得的凭据来登录。但是,这似乎不是一个好方法。我们不能在客户端应用程序中输入此类机密信息。当不同的人使用客户端应用程序时,他们不应输入凭据以访问 Azure Web 应用程序。如何避免输入凭据? Visual Studio(或客户端应用程序)如何连接到 Azure Web 应用?
【问题讨论】:
标签: c# azure wcf authentication