关于通过iis在webservice中获取数据 [英] about getting data in webservice through iis

查看:187
本文介绍了关于通过iis在webservice中获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

aoa ...我想通过iis上的webservice获取数据....但是它给出了以下错误..

因为它在本地主机上工作正常...

错误是:

异常消息是无法打开数据库bcounts登录请求。登录失败。用户'NT AUTHORITY \ NETWORK SERVICE'登录失败

webconfig.file是:



< configuration>

< connectionstrings>



< add name =bcountsdbconnectionstring =数据源= 123-PC;初始目录= bcounts;集成安全性= 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.ipadservicebehaviorconfiguration =servicebehavior>

< endpoint address =binding =webHttpBindingcontract =test.Iipadservicebehaviorconfiguration =web>



<端点地址=mexbinding =mexHttpBinding>

contract =IMetadataExchange/>

< host>

< baseAddresses> ;

< add baseaddress =http:// localhost />

< / baseAddresses>







< behavior>

< servicebehaviors>

< behavior name =servicebehavior >

<! - 为了避免泄露元数据信息,请将以下值设置为false并在部署之前删除上面的元数据端点 - >

< servicemetadata httpgetenabled =true>

<! - 要接收故障中的异常详细信息以进行调试,请将以下值设置为true。在部署之前设置为false以避免泄露异常信息 - >

< servicedebug includeexceptiondetailinfaults =true>

< servicecredentials>

<! - < servicecertificate findvalue =MyWebSite>

storeLocation =LocalMachine

storeName =我的

x509FindType =FindBySubjectName/> - >

< usernameauthentication usernamepasswordvalidationmode =Customcustomusernamepasswordvalidatortype =test.usernamepassvalidator,test>







< endpointbehaviors>

< behavior name =web>

< webhttp automaticformatselectionenabled =false>

defaultBodyStyle =WrappeddefaultOutgoingResponseFormat =Json

helpEnabled =true/>







< servicehostingenvironment multiplesitebindingsenabled =false>



< system.webserver>

< modules runallmanagedmodulesforallrequests =true>









请尽快帮助我:(

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 :(

推荐答案

这意味着您的代码很可能以NETWORK身份执行SERVICE,因此您需要指定使用SQL用户名和密码的连接字符串,或者将您的应用程序池标识更改为具有Sql必要权限的Windows用户。
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.


参考 SQL SERVER - FIX:错误:无法打开登录请求的数据库。登录失败。用户'NT AUTHORITY \ NETWORK SERVICE'登录失败。 [ ^ ]并按照解决方案。
Refer SQL SERVER – FIX : ERROR : Cannot open database requested by the login. The login failed. Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’.[^] and follow the solution.


这篇关于关于通过iis在webservice中获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆