我的解决方案中有WCF Web服务。 service具有在服务类中实现的接口。我在接口中添加了几个新方法,并在服务类中实现。如果我使用服务dll引用我的asp.net mvc 3应用程序,我可以访问。但在部署并添加服务的服务引用后,我无法获得新添加的方法。通过创建客户端对象。为什么要发生这种情况?我在远程服务器上部署了服务。
我也检查了wsdl,但找不到有关新添加方法的元数据。
编辑: 那么好......我不知道发生了什么,不知怎的,我得到了序列化的对象,我现在的预期。但是当我使用这些对象执行任何操作时,我遇到了无法连接到服务的问题。
"An error occurred while receiving the HTTP response to http://MyServer/MyAdminService.svc.
This could be due to the service endpoint binding not using the HTTP protocol.
This could also be due to an HTTP request context being aborted by the server
(possibly due to the service shutting down). See server logs for more details."
Inner Exception:
"The underlying connection was closed: An unexpected error occurred on a receive"
为什么要这样? web.config需要在clent和server对象之间建立连接的必要属性是什么?
解决: http://lalitcdhake.blogspot.com/2011/10/serialization-with-entity-framework-4.html
干杯
答案 0 :(得分:1)
答案 1 :(得分:0)
您是否使用OperationContract属性标记了新方法?来自msdn的样本:
[ServiceContract(Namespace="Microsoft.WCF.Documentation")] public interface ISampleService{ // This operation specifies an explicit protection level requirement. [OperationContract] string SampleMethod(string msg); } class SampleService : ISampleService { #region ISampleService Members public string SampleMethod(string msg) { Console.WriteLine("Called with: {0}", msg); return "The service greets you: " + msg; } #endregion }
答案 2 :(得分:0)
我认为您有部署问题。有些事要尝试。