0

I have a WCF service that when I check in the WCF Test Client it works fine but after I deployed the service to a remote server(my college server) It doesn't work . I ran it on a wp8 app but it didn't gave me the errors so I ran it on the wcf test client and I found out that I cant connect to my DB and I don't know why !

I search all over the web about connection strings because everyone told me that it is probably this but every thing seem fine :(

this is my connection string:

<connectionStrings>
<add name="dbPulpoConnectionString" providerName="System.Data.SqlClient" connectionString="Server=(LocalDb)\v11.0;Initial Catalog=PulpoDatabase;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\PulpoDatabase.mdf"/>

I changed it also to :

 <connectionStrings>
<add name="dbPulpoConnectionString" providerName="System.Data.SqlClient" connectionString="Server=.\SQLEXPRESS;Initial Catalog=PulpoDatabase;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\PulpoDatabase.mdf"/>

but it still didnt work><

edit: In my propretise it says .NET FRAMWORK 4.5

please please help me I dont know what to do anymore><

edit: I have all the premisions I need On the remote server , on the remote server I have App_Data folder that my database.mdf files are in there and web.config and bin and the wcf.svc server

edit: my error:

Object reference not set to an instance of an object. Server stack trace: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at IPulpoService.ShowStatistics(UserVO client) at PulpoServiceClient.ShowStatistics(UserVO client)
4

1 回答 1

0

如果您使用集成安全性来访问数据库,则可能需要使用模拟,以便服务在访问数据库时假定客户端的身份。否则,它将作为可能无权访问数据库的本地系统帐户(或其某种类型)运行。要对此进行测试,您可以尝试更改连接字符串以使用 SQL Server 安全性并将用户名和密码放入连接字符串中,然后查看是否有效。显然这只是一个测试——您实际上不应该像在“实时”环境中那样将密码保存在文件中。

于 2013-05-20T19:52:38.333 回答