Click here to Skip to main content
16,018,818 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
aoa... i want to get data through webservice on iis....but it is giving following error..
as it is working fine in local host...
error is:
The exception message is 'Cannot open database "bcounts" requested by the login. The login failed. Login failed for user 'NT AUTHORITY\NETWORK SERVICE'
webconfig.file is:

<configuration>
<connectionstrings>

<add name="bcountsdb" connectionstring="Data Source=123-PC;Initial Catalog=bcounts;Integrated Security=True" providername="System.Data.SqlClient">

<system.web>
<compilation debug="true" targetframework="4.0">

<system.servicemodel>
<bindings>
<wshttpbinding>
<binding name="CustomAuthentication">
<security mode="Message">
<message clientcredentialtype="UserName">




<services>
<service name="test.ipadservice" behaviorconfiguration="servicebehavior">
<endpoint address="" binding="webHttpBinding" contract="test.Iipadservice" behaviorconfiguration="web">

<endpoint address="mex" binding="mexHttpBinding">
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseaddress="http://localhost/">
</baseAddresses>



<behaviors>
<servicebehaviors>
<behavior name="servicebehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<servicemetadata httpgetenabled="true">
<!-- 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="true">
<servicecredentials>
<!-- <servicecertificate findvalue="MyWebSite">
storeLocation="LocalMachine"
storeName="My"
x509FindType="FindBySubjectName" />-->
<usernameauthentication usernamepasswordvalidationmode="Custom" customusernamepasswordvalidatortype="test.usernamepassvalidator,test">



<endpointbehaviors>
<behavior name="web">
<webhttp automaticformatselectionenabled="false">
defaultBodyStyle="Wrapped" defaultOutgoingResponseFormat="Json"
helpEnabled="true" />



<servicehostingenvironment multiplesitebindingsenabled="false">

<system.webserver>
<modules runallmanagedmodulesforallrequests="true">




kindly help me soon :(
Posted
Updated 5-Jun-14 5:38am
v2

This means your code is likely executing as NETWORK SERVICE so you either need to specify a connection string that uses a SQL username and password or change your app pool identity to be a windows user that has the necessary permissions to Sql.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900