2011-09-21 99 views
0

有兩個模板:一個Middleware和其他webclient。WCF配置中的問題

對於中間件的Web.config是:

<?xml version="1.0"?> 
    <configuration> 
     <configSections> 
     <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > 
      <section name="HoneywellMiddleware.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
     </sectionGroup> 
     </configSections> 
     <system.web> 
     <compilation debug="true" targetFramework="4.0" /> 
     <authentication mode="Windows"/> 
     <anonymousIdentification enabled="true"/> 
     <identity impersonate="true"/> 
     </system.web> 
     <connectionStrings> 
     <add name="SQLConnectionString" connectionString="server=01HW361477;uid=sa;[email protected];database=Honeywell"/> 
     </connectionStrings> 
     <system.serviceModel> 
     <services> 
      <service name="HoneywellMiddleware.HoneywellService" behaviorConfiguration="ServiceBehaviour"> 
      <endpoint address="" binding="webHttpBinding" contract="HoneywellMiddleware.IHoneywellService" behaviorConfiguration="web"/> 
      <host> 
       <baseAddresses> 
       <add baseAddress="http://localhost:56334/HoneywellService.svc"/> 
       </baseAddresses> 
      </host> 
      </service> 
     </services> 
     <behaviors> 
      <serviceBehaviors> 
      <behavior name="ServiceBehaviour"> 
       <!-- 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> 
      <endpointBehaviors> 
      <behavior name="web"> 
       <webHttp/> 
      </behavior> 
      </endpointBehaviors> 
     </behaviors> 
     <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
     </system.serviceModel> 
     <system.webServer> 
     <modules runAllManagedModulesForAllRequests="true"/> 
     </system.webServer> 

    </configuration> 

對於Web客戶端的Web應用程序是這樣的:

<?xml version="1.0"?> 

    <!-- 
     For more information on how to configure your ASP.NET application, please visit 
     http://go.microsoft.com/fwlink/?LinkId=169433 
     --> 
    <configuration> 
     <system.serviceModel> 
     <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> 
     <bindings> 
      <basicHttpBinding> 
      <binding name="HoneywellMiddleware_IHoneywellService"/> 
      </basicHttpBinding> 
     </bindings> 
     <client> 
      <endpoint address="http://localhost:56334/HoneywellService.svc" binding="basicHttpBinding" 
       bindingConfiguration="HoneywellMiddleware_IHoneywellService" contract="HoneywellService.IHoneywellService" 
       name="HoneywellMiddleware_IHoneywellService" /> 
     </client> 
     </system.serviceModel> 
     <connectionStrings> 
     <add name="ApplicationServices" 
      connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" 
      providerName="System.Data.SqlClient" /> 
     </connectionStrings> 
     <system.web> 
     <compilation debug="true" targetFramework="4.0" /> 
     <authentication mode="Forms"> 
      <forms loginUrl="~/Account/Login.aspx" timeout="2880" /> 
     </authentication> 
     <membership> 
      <providers> 
      <clear/> 
      <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" 
       enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" 
       maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" 
       applicationName="/" /> 
      </providers> 
     </membership> 
     <profile> 
      <providers> 
      <clear/> 
      <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/> 
      </providers> 
     </profile> 
     <roleManager enabled="false"> 
      <providers> 
      <clear/> 
      <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" /> 
      <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" /> 
      </providers> 
     </roleManager> 
     </system.web> 
     <system.webServer> 
     <modules runAllManagedModulesForAllRequests="true"/> 
     </system.webServer> 
    </configuration> 

錯誤:

There was no endpoint listening at http://localhost:56334/HoneywellService.svc 
that could accept the message. This is often caused by an incorrect address or 
SOAP action. See InnerException, if present, for more details. 

任何幫助將不勝感激

回答

0

您可能會遇到綁定不匹配(http vs web binding)或者您的合同不匹配(HoneywellService.IHoneywellService vs HoneywellMiddleware.IHoneywellService)。

更改你的客戶端點:

<client> 
     <endpoint address="http://localhost:56334/HoneywellService.svc" binding="webHttpBinding" 
      contract="HoneywellService.IHoneywellService" 
      name="HoneywellMiddleware_IHoneywellService" /> 
    </client> 

<client> 
     <endpoint address="http://localhost:56334/HoneywellService.svc" binding="webHttpBinding" 
      contract="HoneywellMiddleware.IHoneywellService" 
      name="HoneywellMiddleware_IHoneywellService" /> 
    </client>