【发布时间】:2015-10-23 02:28:09
【问题描述】:
我正在开发 wcf 服务,对此我很陌生。这里我根据我看过的视频对web.config文件做了一些修改,但是出现了下面的错误,我不知道它到底在问什么。
谁能帮我解决这个问题?
这是我遇到的错误
错误:无法从 http://localhost:15305/Techieez.svc 获取元数据
如果这是您有权访问的 Windows (R) Communication Foundation 服务,请检查您是否已在指定地址启用元数据发布。有关启用元数据发布的帮助,请参阅位于 http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata 的 MSDN 文档
Exchange 错误 URI:http://localhost:15305/Techieez.svc
元数据包含无法解析的引用:“http://localhost:15305/Techieez.svc”。内容类型应用程序/soap+xml;服务 http://localhost:15305/Techieez.svc 不支持 charset=utf-8。
客户端和服务绑定可能不匹配。
远程服务器返回错误:(415) 无法处理消息,因为内容类型为 'application/soap+xml; charset=utf-8' 不是预期的类型 'text/xml; charset=utf-8'..
HTTP GET 错误 URI:http://localhost:15305/Techieez.svc
HTML 文档不包含 Web 服务发现信息。
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
<add key="con" value="uid=sa;password=572572;database=techieez;server=techz"/>
<add key="from" value="surya.lbits@gmail.com"/>
<add key="password" value="****"/>
<add key="webPages:Version" value="2.0" />
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
<add key="webpages:Enabled" value="true" />
<add key="mail" value="smtp.gmail.com"/>
<add key="visa" value="surya.lbits@gmail.com"/>
<add key="port" value="587"/>
<add key="html" value="true"/>
<add key="ssl" value="true"/>
<add key="credit" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<sessionState cookieless="UseCookies" cookieName="user" timeout="525600" />
<httpRuntime executionTimeout="500000" targetFramework="4.5" maxRequestLength="2000000" maxQueryStringLength="2000000" enable="true" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding_Techieez" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2097152"
maxArrayLength="2097152" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="TechieezService.Techieez">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration=""
contract="TechieezService.ITechieez" />
<endpoint address="Web" behaviorConfiguration="WebBehaviour"
binding="webHttpBinding" bindingConfiguration="" name="WebEndPoint"
contract="TechieezService.ITechieez" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="WebBehaviour">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="DefaultBehaviour">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
【问题讨论】:
-
将
behaviorConfiguration的service设置为DefaultBehaviour。 -
为什么你的配置不起作用。
basicHttpBinding和webHttpBinding不会一起工作。 -
有什么方法可以将我的配置文件更改为以前的状态。如果可能,请帮助我
-
不知道之前的状态
-
重新排列您的系统。服务模型部分正确
标签: c# web-services wcf utf-8