Link to home
Start Free TrialLog in
Avatar of basil365
basil365Flag for Ireland

asked on

WCF - Read File - Logon failure: unknown user name or bad password

Hi guys,

I have a WCF service that needs to read a file off a network drive.

Everytime the service tries to access the file I'm getting an error saying:

Logon failure: unknown user name or bad password


What do I need to do to allow the service to access the file? I'm guessing I need to set something in the Web.Config file, but I'm not sure what?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Vel Eous
Vel Eous

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of basil365

ASKER

I'm getting the error when trying to access the file.

I haven't set the security configurations, below is bindings section of my Web.Config file:

<bindings>
  <wsHttpBinding>
	<binding name="Binding1"  maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
	  <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
		  maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
	  <security mode="None"/>
	  <!-- Binding property values can be modified here. -->
	  <!--See the next procedure. -->
	</binding>
  </wsHttpBinding>
  <basicHttpBinding>
	<binding name="BasicHttpBinding_IService" closeTimeout="00:01:00"
		openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
		allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
		maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
		messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
		useDefaultWebProxy="true">
	  <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
		  maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
	  <security mode="None">
		<transport clientCredentialType="None" proxyCredentialType="None"
			realm="" />
		<message clientCredentialType="UserName" algorithmSuite="Default" />
	  </security>
	</binding>
  </basicHttpBinding>
</bindings>

Open in new window

I've looked at the Message Security articles in the link you provided, but I'm still not sure what exactly needs to be set to allow the service to access the file.

Thanks.
How are you connecting to network drive (UNC, WebDAV), and are you passing user name and password for connecting to the drive.