2013-06-20 2 views
0

Базовое соединение закрыто: соединение было закрыто неожиданноБазовое соединение закрыто: соединение было закрыто неожиданно ФОС службы

Это общая ошибка, и так как я очень новый ФОС я не знаю где начать диагностировать проблему. Я много часов искал в Google, и мне действительно нужен совет от кого-то, у кого больше опыта работы с wcf. Поэтому, пожалуйста, медведь со мной, я постараюсь описать проблему как можно лучше. Мой домен составлен из проекта wcf и проекта библиотеки классов, где у меня есть сущности данных. У меня есть 1 файл svc. Я вызываю службу в своем контроллере asp.net mvc 3. делая что-то довольно простое. Я опубликую соответствующий код и трассировку стека.

Я пытаюсь отобразить список кандидатов в списке действий контроллера кандидатов. Я добавил ссылку на службу в проект mvc и указал ее на мой localhost (сервис, который был обнаружен и он запущен).

Трассировка стека:

[WebException: The underlying connection was closed: The connection was closed unexpectedly.] 
    System.Net.HttpWebRequest.GetResponse() +6117395 
    System.ServiceModel.Channels.HttpChannelRequest.WaitForReply(TimeSpan timeout) +48 

[CommunicationException: The underlying connection was closed: The connection was closed unexpectedly.] 
    System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +9440287 
    System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +345 
    ADMWeb.UI.ADMServices.IADM.GetCandidateList() +0 
    ADMWeb.UI.ADMServices.ADMClient.GetCandidateList() in C:\Users\ori\Documents\Visual Studio 2010\Projects\ADMWeb\ADMWeb.UI\Service References\ADMServices\Reference.cs:1025 
    ADMWeb.UI.Controllers.CandidatesController.Index() in C:\Users\ori\Documents\Visual Studio 2010\Projects\ADMWeb\ADMWeb.UI\Controllers\CandidatesController.cs:22 
    lambda_method(Closure , ControllerBase , Object[]) +62 
    System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17 
    System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27 
    System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263 
    System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191 
    System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343 
    System.Web.Mvc.Controller.ExecuteCore() +116 
    System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97 
    System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 
    System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37 
    System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21 
    System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12 
    System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 
    System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50 
    System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7 
    System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22 
    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60 
    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9030045 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184 

Ошибка:

Line 1024:  public ADMWeb.UI.ADMServices.Candidate[] GetCandidateList() { 
Line 1025: return base.Channel.GetCandidateList(); Line 1026:  } 

ADM.svc:

namespace ADMServices 
{ 
    public class ADM : IADM 
    { 
     public List<Candidate> GetCandidateList() 
     { 
      List<Candidate> candidateList = new List<Candidate>(); 
      candidateList = CandidateManager.GetCandidateList(); 

      return candidateList; 
     } 
    } 
} 

Кандидаты Controller (Список действий):

ADMClient client = new ADMClient(); 
List<Candidate> candidates = client.GetCandidateList().ToList(); 
return View(candidates); 
web.config

WCF проекта:

<?xml version="1.0"?> 
<configuration> 

    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <connectionStrings> 
    <add name="ADMConnectionString" connectionString="Data Source=;Initial Catalog=ADM_ATID;Persist Security Info=True;User ID;Password" 
    providerName="System.Data.SqlClient" /> 
    </connectionStrings> 
    <system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <!-- 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="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 
    <system.diagnostics> 
    <sources> 
     <source name="System.ServiceModel" 
       switchValue="Information, ActivityTracing" 
       propagateActivity="true" > 
     <listeners> 
      <add name="xml"/> 
     </listeners> 
     </source> 
     <source name="System.ServiceModel.MessageLogging"> 
     <listeners> 
      <add name="xml"/> 
     </listeners> 
     </source> 
     <source name="myUserTraceSource" 
       switchValue="Information, ActivityTracing"> 
     <listeners> 
      <add name="xml"/> 
     </listeners> 
     </source> 
    </sources> 
    <sharedListeners> 
     <add name="xml" 
      type="System.Diagnostics.XmlWriterTraceListener" 
      initializeData="Error.svclog" /> 
    </sharedListeners> 
    </system.diagnostics> 
</configuration> 

MVC web.config:

<system.serviceModel> 
<bindings> 
    <basicHttpBinding> 
    <binding name="BasicHttpBinding_IADM" closeTimeout="00:01:00" 
     openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
     allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
     maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
     messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
     useDefaultWebProxy="true"> 
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
     maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <security mode="None"> 
     <transport clientCredentialType="None" proxyCredentialType="None" 
      realm="" /> 
     <message clientCredentialType="UserName" algorithmSuite="Default" /> 
     </security> 
    </binding> 
    </basicHttpBinding> 
</bindings> 
<client> 
    <endpoint address="http://localhost:49341/ADM.svc" binding="basicHttpBinding" 
    bindingConfiguration="BasicHttpBinding_IADM" contract="ADMServices.IADM" 
    name="BasicHttpBinding_IADM" /> 
</client> 

+0

Привет, Ольст, вы нашли решение? Я ждал ответа от вас на мой последний вопрос. – Anu

ответ

2

Первое, что я буду делать это, вместо того, чтобы вернуться в полный список кандидатов я вернусь пустой список. Если это хорошо работает, то очень ясно, что размер данных является проблемой. Чтобы изменить размер игры с параметрами привязки.

+0

Спасибо, вы были правы, пустой список работает отлично. Не могли бы вы уточнить, что вы имеете в виду «играйте с параметрами привязки»? – vobs

+0

Можете ли вы разместить свой файл конфигурации-привязка и поведение? – Anu

+0

Привет, извините за задержку, но хотя пустой список возвращает OK, я попытался сделать 10-ти записей и по-прежнему дает ошибку. опубликует мои конфиги. – vobs

Смежные вопросы