开发者

Problem in WCF Configuration

开发者 https://www.devze.com 2023-04-06 13:34 出处:网络
There are two templates:one Middleware and other the webclient. The web.config for the Middleware is as :

There are two templates:one Middleware and other the webclient.

The web.config for the Middleware is as :

<?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;pwd=MSS@L2008;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 va开发者_开发问答lue 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>

For the webclient web application it is like this :

<?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>

Error:

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.

Any help will be appreciated


Either you have a binding mismatch (http vs web binding) or you have a contract mismatch (HoneywellService.IHoneywellService vs HoneywellMiddleware.IHoneywellService).

Change your client endpoint to:

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

or

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号