2012-07-12 43 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