我已经使用wsHttpBinding创建了一个服务,但每次我下载该服务时,它都会在客户端的配置中创建基本的wsHttpBinding。你知道为什么吗?thansk
<system.serviceModel>
<serviceHostingEnvironment/>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding" sendTimeout="00:10:00" receiveTimeout="00:59:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="50000000" maxReceivedMessageSize="50000000"
messageEncoding="Mtom" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="50000000"
maxArrayLength="50000000" maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
<reliableSession inactivityTimeout="00:59:00" />
<security mode="Message">
<!--<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />-->
<message clientCredentialType="UserName" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="AdviserPayServiceBehaviour" name="AdviserPay.Services.FirstService.FirstService">
<endpoint binding="wsHttpBinding" bindingConfiguration="WSHttpBinding" contract="AdviserPay.Services.FirstService.IFirstService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="AdviserPayServiceBehaviour">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceAuthorization principalPermissionMode="None" impersonateCallerForAllOperations="false" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom"
membershipProviderName="AdviserPayCustomMembershipProvider" />
</serviceCredentials>
<serviceSecurityAudit auditLogLocation="Application" suppressAuditFailure="false"
serviceAuthorizationAuditLevel="None" messageAuthenticationAuditLevel="SuccessOrFailure" />
<serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>发布于 2011-01-04 10:09:47
.svc标记文件中的服务名称可能与web.config中指定的名称不匹配。
当WCF启动您的服务时,框架将检查.svc文件中的服务名称,然后在web.config中查找与该名称匹配的配置。如果没有找到,它将使用默认配置- BasicHttpBinding。
要解决您的问题:
查看标记右键单击FirstService.svc
发布于 2013-01-26 04:43:32
我也有同样的问题,但我的服务是有效的。在我的例子中,我公开了两个绑定,都是basichttp和wshttp。我有一个在.net 3.5上新创建的测试网站。当它获得服务引用时,我注释掉了基本端点。这一切都很好用。
然而,真正的消费者是一个网站,它最初是在.net 2.0中创建的,后来升级到了4.0。因此,我执行与前面相同的过程,注释掉basicHttp端点。但发生的情况是,当我调用服务时得到异常,它期望发送和接收http,服务器在此测试中拒绝连接。
这必须是与升级到4.0的网站,而不是最初在3.5或更高版本创建的东西。我可以断定这是一种升级情况,因为通常存在的属性文件夹并不存在于真正的服务使用者站点上。
必须有一个标志/设置才能打开,但我不确定是什么。
https://stackoverflow.com/questions/4589895
复制相似问题