0

私のウェブサイトは有効になってWindows AuthenticationおりAnonymous Authentication、データベース接続もWindows認証を使用しています(ユーザーログインに基づく)。

電話AJAX-Enabled WCF Serviceしましたが、匿名で認証されています。

IEではすべて正常に動作します。しかし、これを Firefox で開くと、例外がスローされます。

ユーザー 'NT AUTHORITY\ANONYMOUS LOGON' のログインに失敗しました。

ここに画像の説明を入力

Web.config

    <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>
4

1 に答える 1

0

このページが参考になると思います

JavaScript または jquery でクロス ドメイン WCF サービスを呼び出そうとすると、ブラウザによって動作が異なります。jquery/javascript または ajax を使用して、クロス ドメイン wcf サービスまたは通常のサービスで「POST」または「GET」リクエストを実行する場合、ブラウザは実際には、wcf メソッドで言及されていない wcf サービスに「OPTIONS」動詞呼び出しを送信します。属性

http://www.dotnet-tricks.com/Tutorial/wcf/X8QN260412-Calling-Cross-Domain-WCF-Service-using-Jquery.html

于 2013-05-22T23:08:05.137 に答える