c# - My web application is rejecting Windows authentication for a local Windows account -


my issue service lets own windows account connect it, allow connections valid windows domain accounts. service hosted in iis express. when browse https://localhost:44300/fileretrievalservice.svc/get in google chrome, see [webget] method called fine. when try create web request it, works, long specify own windows user account:

webrequest request = webrequest.create(url); request.method = "get"; request.headers.add("path", filepath); request.credentials = new networkcredential("username", "password", "localhost"); return request.getresponse(); 

when try specifying different local windows account on machine authenticate user against service changing "username" , "password" in above code account know sure exists on machine, following error:

system.net.webexception: remote server returned error: (401) unauthorized.

i have following in service's web.config:

<?xml version="1.0"?> <configuration>   <appsettings>     <add key="aspnet:usetaskfriendlysynchronizationcontext" value="true" />   </appsettings>   <system.web>     <compilation debug="true" targetframework="4.5" />     <httpruntime targetframework="4.5"/>   </system.web>   <system.servicemodel>     <bindings>       <webhttpbinding>         <binding name="webhttpbindingwithtransportsecurity">           <security mode="transport">             <transport clientcredentialtype="windows"/>           </security>         </binding>       </webhttpbinding>     </bindings>     <services>       <service name="fileretrievalpocv3.fileretrievalservice">         <endpoint behaviorconfiguration="webbehavior" binding="webhttpbinding" bindingconfiguration="webhttpbindingwithtransportsecurity" contract="fileretrievalpocv3.ifileretrieval" />       </service>     </services>     <behaviors>       <endpointbehaviors>         <behavior name="webbehavior">           <webhttp />         </behavior>       </endpointbehaviors>     </behaviors>     <servicehostingenvironment aspnetcompatibilityenabled="true" multiplesitebindingsenabled="true" />   </system.servicemodel>   <system.webserver>     <modules runallmanagedmodulesforallrequests="true"/>     <directorybrowse enabled="false"/>   </system.webserver> </configuration> 

what cause of issue?

i'm going guess account has admin priveleges, , other account not. if that's case, need explicitly give permissions project folder (i.e. using windows explorer) or assign user group has permission.


Comments