即时通讯编写一个web服务,假设将json两个json字符串保存到数据库。 我可以调用它与UI和WCF测试客户端,但我不能从我的浏览器调用它。 有没有办法做到这一点?如何从浏览器调用我的WCF服务?
该服务最初将被android应用程序使用,并且我已经尝试过从它调用没有任何运气。
谢谢先进。
这里是我的服务
[ServiceContract]
public interface IRService
{
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "SaveCallResults?callInfo={callInfo}&testInfo={testInfo}")]
string SaveCallResults(string callInfo, string testInfo);
}
的界面,这里是我的web.config
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_RService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxBufferSize="65536" maxReceivedMessageSize="65536"
textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"
messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false"
multipleSiteBindingsEnabled="true" />
<services>
<!-- causing error -->
<!--<service name="NovaRoadRunnerWS.RService" behaviorConfiguration="ServiceBehaviour" >
<endpoint address="" binding="webHttpBinding" contract="NovaRoadRunnerWS.IRService" behaviorConfiguration="web" >
</endpoint>
</service>-->
</services>
您正在服务上使用'webHttpBinding',但是您正在为**'basicHttpBinding'创建自定义绑定配置** - 为什么?!?!? – 2013-04-07 18:28:11