我正在使用soap(wcf)构建服务。我想通过一个密码和用户名让我的端点更安全一些。当我尝试添加以下配置时,Windows Azure会引发以下错误:Windows Azure基本身份验证在云中不起作用?
错误:此配置节不能用于此路径。当部分锁定在父级别时,会发生这种情况。锁定可以是默认的(overrideModeDefault =“Deny”),也可以是带有overrideMode =“Deny”或legacy allowOverride =“false”的位置标签。
Linecode是: 我在测试locale时必须在我的IIS中更改此设置,但在Windows Azure平台上我无法调整它吗?
我想要做的就是使用自己的密码和用户名进行访问。是
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="credsBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata externalMetadataLocation="external metadata location" />
<!-- 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="false" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WCFServiceWebRole.CustomUserNameValidator, WCFServiceWebRole, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="ServiceEndpointBehavior">
<schemaValidator validateRequest="True" validateReply="False">
<schemas>
<add location="schemalocation" />
</schemas>
</schemaValidator>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="false" />
<extensions>
<behaviorExtensions>
<add name="schemaValidator" type="WCFServiceWebRole.Validation.SchemaValidationBehaviorExtensionElement, WCFServiceWebRole, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</behaviorExtensions>
</extensions>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpsBinding_CvServiceInterface" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" receiveTimeout="01:00:00" openTimeout="01:00:00" closeTimeout="01:00:00" sendTimeout="01:00:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="Basic"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="WCFServiceWebRole.CvService" behaviorConfiguration="credsBehavior">
<endpoint address="myendpoint" behaviorConfiguration="ServiceEndpointBehavior" binding="basicHttpBinding" bindingConfiguration="BasicHttpsBinding_CvServiceInterface" contract="ICvService" />
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true" />
<security>
<authentication>
<basicAuthentication enabled="true"/>
</authentication>
</security>
</system.webServer>
</configuration>
<!--<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false" />
<basicAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>-->
的Jeroen
就像我说的,当我主持我在Windows Azure(使用IIS)上的服务我使用基本身份验证错误。 (原因就像你之前提到的那样,基本身份验证未启用)。如果您了解我的问题的其他方法或解决方案,请成为我的客人。我只需要客户端填写用户名和密码,以在服务器端验证用户名和密码。我对此事比较陌生,所以 – 2012-04-13 12:29:12
您可以从web.config中删除安全元素,这是导致问题的原因。 WCF基础结构中存在安全性。按照本指南使用自定义用户名/密码认证:http://blogs.msdn.com/b/pedram/archive/2007/10/05/wcf-authentication-custom-username-and-password-validator.aspx – 2012-04-13 12:36:45