2012-07-12 42 views
0

我消耗加上服務引用到我的項目WCF然後,我改變了web.confing是那樣的使用WCF在asp.net錯誤

<?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> 
    <connectionStrings> 
    <add name="ApplicationServices" connectionString="data source=.;initial catalog=Services;user id=sa;password=123;Connect Timeout=45;"/> 
    </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> 

    <system.serviceModel> 
    <services> 
     <service name="DreamServices.DreamService"> 
     <endpoint address="" binding="webHttpBinding" contract="DreamServices.IServices" behaviorConfiguration="web"> 
     </endpoint> 
     </service> 
    </services> 
    <behaviors> 
     <endpointBehaviors> 
     <behavior name="web"> 
      <webHttp /> 
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/> 
     </behavior> 
     </endpointBehaviors> 
     <serviceBehaviors> 
     <behavior> 
      <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <bindings> 
     <webHttpBinding> 
     <binding name="defaultRest"> 
      <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="64" maxNameTableCharCount="2147483647" /> 
      <security mode="None" /> 
     </binding> 
     </webHttpBinding> 
    </bindings> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 


    <appSettings> 
    <add key="JsonWebService" value="http://localhost:1381/PMAHost/Service.svc" /> 
    </appSettings> 


</configuration> 

但我總是得到的異常

未能進行找到ServiceModel客戶端配置部分中引用合同'ServiceReference.IServices'的默認端點元素。這可能是因爲沒有找到適用於您的應用程序的配置文件,或者因爲在客戶端元素中找不到匹配此合同的端點元素。

模塊system.serviceModel重複無論是在圖書館或網站

任何想法如何解決這個問題

回答

1

這是一個服務端配置

<service name="DreamServices.DreamService"> 

什麼客戶端配置看起來像?它應該有一個客戶端元素contract="DreamServices.IServices"或任何合同的名稱。

+0

請把它放在哪裏 – AMH 2012-07-13 07:30:42

+0

你的意思是什麼客戶端配置 – AMH 2012-07-13 07:36:08

+0

在WCF中有'客戶端'(發送請求的進程)和'服務'(接收請求的進程)的配置, 。你已經發布了'服務'的配置。檢查「客戶端」的配置。 – 2012-07-13 08:17:36