C# 在Firefox中对启用AJAX的WCF服务启用Windows身份验证不工作
我的网站启用了C# 在Firefox中对启用AJAX的WCF服务启用Windows身份验证不工作,c#,asp.net,wcf,iis,wcf-data-services,C#,Asp.net,Wcf,Iis,Wcf Data Services,我的网站启用了Windows身份验证和匿名身份验证,数据库连接也使用Windows身份验证(基于用户登录) 我调用了支持AJAX的WCF服务,它是匿名身份验证的 在IE上一切正常。但当我用Firefox打开它时,引发了一个异常: 用户“NT授权\匿名登录”登录失败 Web.config ..... ..... 我想这一页可以帮助你 每当您试图通过javascript或jquery调用跨域WCF服务时,它在不同的浏览器中的行为会有所不同。当您想使用jquery/javascript或aja
Windows身份验证
和匿名身份验证
,数据库连接也使用Windows身份验证(基于用户登录)
我调用了支持AJAX的WCF服务,它是匿名身份验证的
在IE上一切正常。但当我用Firefox打开它时,引发了一个异常:
用户“NT授权\匿名登录”登录失败
Web.config
.....
.....
我想这一页可以帮助你
每当您试图通过javascript或jquery调用跨域WCF服务时,它在不同的浏览器中的行为会有所不同。当您想使用jquery/javascript或ajax对跨域wcf服务或普通服务执行“POST”或“GET”请求时,浏览器实际上会向wcf服务发送一个“选项”动词调用,而wcf方法属性中没有提到该调用
<authentication mode="Windows">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
<identity impersonate="true" />
<authorization>
<deny users="?" />
</authorization>
.....
.....
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<!--<behavior name="metadataBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
</behavior>-->
<!-- Step 2. Add a new behavior below.-->
<behavior name="metadataBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
<!-- Step 3. Add a <serviceDebug> element -->
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<serviceAuthorization/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="Mycompany.SGACostReduction.EditInitiativesAspNetAjaxBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<webHttp helpEnabled="true"/>
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint automaticFormatSelectionEnabled="false"
helpEnabled="true"
defaultOutgoingResponseFormat="Json"
name=""/>
</webHttpEndpoint>
</standardEndpoints>
<services>
<service name="Mycompany.SGACostReduction.EditInitiatives" behaviorConfiguration="metadataBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:57771/EditInitiatives.svc" />
</baseAddresses>
</host>
<endpoint address="" behaviorConfiguration="Mycompany.CostReduction.EditInitiativesAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="webBinding" contract="Alixpartners.SGACostReduction.EditInitiatives" >
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="webBinding">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="Windows" />
</security>
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>