使用匿名认证配置REST wcf



我有一个关于在JSON中与网站的一些客户端部分通信的web服务的问题webservice是网站内部的解决方案,使用VB在aspx页面(web表单)

我的web配置是:

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding name="Binding1">
          <security  mode="None">
            <transport  clientCredentialType="None" />
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          </behavior>
        </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="ServiceAspNetAjaxBehavior">
          <enableWebScript/>
          </behavior>
        </endpointBehaviors>
    </behaviors>
    <!--<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>-->
    <services>
      <service name="Z60MRTR002.FrmCommandeAction" behaviorConfiguration="ServiceBehavior">
        <endpoint address="" binding="webHttpBinding" bindingConfiguration="Binding1" contract="Z60MRTR002.FrmCommandeAction" behaviorConfiguration="ServiceAspNetAjaxBehavior" ></endpoint>
          <!--<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />-->
      </service>
    </services>
  </system.serviceModel>
  <system.web>
    <compilation defaultLanguage="vb" debug="true" targetFramework="4.0"/>
    <customErrors mode="Off"/>
    <authentication mode="Windows"/>
    <authorization>
        <allow users="*"/>
    </authorization>
    <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20"/>
    <globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
  <appSettings>
            <!-- SOME SETTINGS -->
  </appSettings>
</configuration>

和i在IIS服务器上激活匿名认证。

它在IISExpress(本地)上工作得很好,但在我的生产服务器(iis6.0)上不行,帮助!

错误是:

[NotSupportedException: Les parpartres de ssamezicentre ce service requirent l' authentication 'Anonymous', mais le 'est pas active samezicentre l'application IIS qui hsamezge service.]

:此服务的安全参数需要"匿名"身份验证,但它没有为托管IIS应用程序激活

编辑:我将wcf复制并粘贴到一个新的wcf项目中,并将其发布到服务器上,确保启用了匿名验证。它告诉我auth没有激活。

是这样的:https://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/f594e137-e2da-4b22-ab58-f8edba938802.mspx?mfr=true

如果你需要更多的信息,尽管问我。谢谢!

确保在IIS中启用匿名认证,如下所示:https://technet.microsoft.com/en-us/library/cc731244%28v=ws.10%29.aspx

我发现了我的错误,它不在web配置附近,也不在服务器的配置。我实际上有一个叫做HttpContext.Current的子函数。用户

服务器返回错误,即使它是激活的:所以对于任何激活匿名认证并且仍然得到错误的人来说,您可能必须仔细检查您的代码:)

我仍然不确定为什么它在iisExpress上工作。也许它正在调试的事实允许iisE访问HTTPcontext

最新更新