【发布时间】:2011-04-21 05:03:52
【问题描述】:
我正在开发一个使用 Silverlight 4 和 WCF 的项目。所有的网络方法,除了一个都工作正常。在 Silverlight 中,我使用自定义 xaml 编写器编写字符串,我想将字符串保存在数据库中。使用Web服务上的Insert方法,只要字符串参数不太大,我就可以插入数据。尝试插入由 xaml 编写器创建的字符串时,出现错误。我使用 Fiddler 来跟踪错误,我得到了 HTTP 400 错误。我在许多帖子中读到,我需要更改 Web 应用程序中的服务托管和 Silverlight 应用程序的客户端配置中的配置设置。我已经进行了我可以在网上找到的所有更改。我不知道还能尝试什么,而且我的资源已经用完了。当我将 xaml 字符串粘贴到记事本中并保存时,该文件只有 425 KB。这里是我对每个配置文件所做的更改。希望有人能指出我遗漏的任何内容。感谢您查看我的问题。
web 应用中的 web.config 文件:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<!-- Enable the serializer to serialize greater number of records -->
<behavior name="CustomServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="CustomBinding">
<readerQuotas maxDepth="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
ServiceReferences.ClientConfig:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_DBService" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost.:49436/BuilderWebService/DBService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_DBService"
contract="ServiceReference1.DBService" name="BasicHttpBinding_DBService" />
</client>
</system.serviceModel>
【问题讨论】:
标签: silverlight wcf