.net - Cannot set authorization rules in web.config for WCF Service -


i read on post can use asp.net authorization in web config control access wcf web service replace following attribute:

[principalpermission(securityaction.demand, role="administrators")] 

to test have been using "administrators" valid role should allow me access , "test" isnt. works fine when using above attribute when comment out , use in web.config file:

<authentication mode="windows" /> <authorization>   <allow roles=".\test"/>   <deny roles="*"/> </authorization> 

it still allows me access.

so wondering if have got wrong in web.config or whether read wrong saying use that.

just reference post looked at:

using windows role authentication in app.config wcf

and following web.config:

<?xml version="1.0"?> <configuration>    <system.web>     <compilation debug="true" targetframework="4.0" />     <authentication mode="windows" />     <authorization>       <allow roles=".\test"/>       <deny users="*"/>     </authorization>   </system.web>   <system.servicemodel>     <bindings>       <basichttpbinding>         <binding name="basichttpendpointbinding">           <security mode="transportcredentialonly">             <transport clientcredentialtype="windows" />           </security>         </binding>       </basichttpbinding>     </bindings>     <services>       <service behaviorconfiguration="wcfservice1.servicebehaviour1" name="wcfservice1.service1">         <endpoint address="" binding="basichttpbinding" bindingconfiguration="basichttpendpointbinding"                   name="basichttpendpoint" contract="wcfservice1.iservice1">           <identity>             <dns value="localhost"/>           </identity>         </endpoint>       </service>     </services>     <behaviors>       <servicebehaviors>         <behavior name="wcfservice1.servicebehaviour1">           <!-- avoid disclosing metadata information, set value below false , remove metadata endpoint above before deployment -->           <servicemetadata httpgetenabled="true"/>           <!-- receive exception details in faults debugging purposes, set value below true.  set false before deployment avoid disclosing exception information -->           <servicedebug includeexceptiondetailinfaults="false"/>         </behavior>       </servicebehaviors>     </behaviors>     <servicehostingenvironment multiplesitebindingsenabled="true" />   </system.servicemodel>  <system.webserver>     <modules runallmanagedmodulesforallrequests="true"/>   </system.webserver>  </configuration> 

thanks.

asp.net authorization rules not used wcf services if wcf hosted side-by-side asp.net. use them must turn wcf service asp.net compatibility mode.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -