Results 1 to 2 of 2

Thread: [RESOLVED] wcf - does not use the right credentials to connect to the DB

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Dunmow,Essex,England
    Posts
    898

    Resolved [RESOLVED] wcf - does not use the right credentials to connect to the DB

    Hi All, I'm on the last leg of splitting my app out. Originally when my application was a single web project, everything worked.

    I've now split my long running processes out into a WCF Service and am finally hosting it correctly under a windows service. I can make a successful reference to the windows service from my client. So far so good.

    Now, when I attempt to do an end to end test, the whole lot crashes dramatically in the WCF Service Library. debugging the windows service which takes me nicely into the WCF Service reveals the following error when I am trying to make a connection to the database so that I can execute a stored proc:

    login failed for user CH\\A002993$

    A002993$ is my workstation ID. In the App.Config file for the WCF service I have:

    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
     <connectionStrings>
    		<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
    		<add name="Database" connectionString="Data Source=D-SQL21;Initial Catalog=AIS_DEV;User Id=import;Password=password" providerName="System.Data.SqlClient" />
    	</connectionStrings>
      <system.web>
        <compilation debug="true" />
      </system.web>
      <!-- When deploying the service library project, the content of the config file must be added to the host's 
      app.config file. System.Configuration does not support config files for libraries. -->
      <system.serviceModel>
     	  <bindings>
    		  <netTcpBinding>
    			  <binding name="NetTcpEndPoint" receiveTimeout="24:00:00" closeTimeout="24:00:00" openTimeout="00:15:00" transactionProtocol="OleTransactions">
    				  <readerQuotas maxNameTableCharCount="163840" maxArrayLength="163840" maxStringContentLength="12000"/>
    				  <reliableSession ordered="true" inactivityTimeout="00:30:00"/>
    		<!--		  <security mode="Transport">
    					  <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
    					  <message clientCredentialType="Windows" />
    				  </security> -->
    			  </binding>
    		  </netTcpBinding>
    		  <customBinding>
    			  <binding name="NetTcpMetadataPoint">
    				  <textMessageEncoding>
    					  <readerQuotas maxNameTableCharCount="163840"/>
    				  </textMessageEncoding>
    			  </binding>
    		  </customBinding>
    	  </bindings>
        <services>
          <service name="wcfBorderauxIRSService.IRSService" behaviorConfiguration="IRSBehaviour">
    		  <host>
    			  <baseAddresses>
    			<!--	  <add baseAddress="ttp://localhost:8732/Design_Time_Addresses/wcfBorderauxIRSService/Service1/" /> -->
    				  <add baseAddress="net.tcp://localhost:8730/wcfBorderauxIRSService"/>
    			  </baseAddresses>
    		  </host>
     		  <endpoint name ="NetTcpEndPoint"
    					address =""
    					binding ="netTcpBinding"
    					contract ="wcfBorderauxIRSService.IRS"
    					bindingConfiguration="NetTcpEndPoint">
    			  <identity>
    				  <dns value="localhost"/>
    			  </identity>
    		  </endpoint>
    		  <endpoint name="NetTcpMetadataPoint"
    					address="mex"
    					binding="mexTcpBinding"
    					contract="IMetadataExchange"
    					bindingConfiguration=""/>
    	<!--	<endpoint address="mex" binding="mexHttpBinding"
              contract="IMetadataExchange" /> -->
            
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="IRSBehaviour">
              <!-- To avoid disclosing metadata information, 
              set the value below to false and remove the metadata endpoint above before deployment -->
              <serviceMetadata httpGetEnabled="False"/>
              <!-- To receive exception details in faults for debugging purposes, 
              set the value below to true.  Set to false before deployment 
              to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="False" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    
      <appSettings>
    	<add key="DropZone" value="C:\Temp" />
    	<add key="ReviewUser" value="Andrew Smith" />
    	<add key="ReviewUser1" value="Monju Deb" />
    	<add key="CompletedFolder" value="C:\Temp\Completed" />
    	<add key="UserRole" value="2045" />
    	<add key="IRSDropZone" value="C:\Temp\IRS"/>  
      </appSettings>
    </configuration>
    the windows Service has been set up to log on as a Network Service and right mouse clicking on the service for it's properties shows that the log on tab has log on as: set to 'This Account' and account set to NT AUTHORITY\NetworkServices. I want the wcf service to login using a database user?

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Dunmow,Essex,England
    Posts
    898

    Re: wcf - does not use the right credentials to connect to the DB

    ok,

    I have given the NT Authority\network Service user access to SQL Server and on the Database given this user roles of db_datareader and db_datawriter. this now results in an error: login failed for user import. I have also removed integrated security = true from the connection string

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width