部署/发布后WCF服务器不起作用

时间:2013-05-20 17:51:22

标签: mysql wcf connection-string wcf-data-services publish

我有一个WCF服务,当我检查WCF测试客户端它工作正常,但我将服务部署到远程服务器(我的大学服务器)后它不起作用。我在一个wp8应用程序上运行它,但它没有给我错误,所以我在wcf测试客户端运行它,我发现我无法连接到我的数据库,我不知道为什么!

我在网上搜索有关连接字符串的内容,因为每个人都告诉我这可能是这样,但每件事情似乎都很好:(

这是我的连接字符串:

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

我也改为:

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

但它仍然无效&gt;&lt;

编辑:在我的建议中,它说.NET FRAMWORK 4.5

请帮助我,我不知道该怎么办&gt;&lt;

编辑:我有我需要的所有前提在远程服务器上,在远程服务器上我有我的database.mdf文件所在的App_Data文件夹,web.config和bin以及wcf.svc服务器

编辑:我的错误:

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)

1 个答案:

答案 0 :(得分:0)

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