正在处理连接到我们服务器上的WCF服务的Silverlight应用程序。我正在使用.NET 4.0进行开发。一切都在本地工作正常,但我尝试在我们的服务器上部署WCF服务,它不起作用。
服务运行正常,我通过在浏览器中输入URL进行检查。但每当我从我的Silverlight应用程序拨打电话时,它都会失败并显示错误:
System.ServiceModel.CommunicationException:远程服务器返回错误:NotFound。
下面给出了我的Web.Config文件的详细错误。我使用fiddler检查消息,我可以看到来自服务器的响应包含文本。
答FailedAuthentication。访问被拒绝。
我该怎么做才能解决这个问题?问题是我的托管服务器不允许在IIS中打开Windows身份验证。无法找到该设置。我正在使用godaddy windows hosting。
任何指针?
Web.Config中:
<authentication mode="Windows"/>
<customErrors mode="Off"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"></serviceHostingEnvironment>
<services>
<service name="WarpArtOnline.Service1" behaviorConfiguration="WarpArtOnline.Service1Behavior">
<endpoint binding="basicHttpBinding" bindingConfiguration="MaxSizeBinding" contract="WarpArtOnline.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>-->
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="MaxSizeBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<!--<transport clientCredentialType="Windows"/>-->
<!--<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />-->
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="WarpArtOnline.Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<authentication mode="Windows"/>
<customErrors mode="Off"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"></serviceHostingEnvironment>
<services>
<service name="WarpArtOnline.Service1" behaviorConfiguration="WarpArtOnline.Service1Behavior">
<endpoint binding="basicHttpBinding" bindingConfiguration="MaxSizeBinding" contract="WarpArtOnline.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>-->
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="MaxSizeBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<!--<transport clientCredentialType="Windows"/>-->
<!--<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />-->
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="WarpArtOnline.Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
错误:
答案 0 :(得分:0)
您是否修改了 clientaccesspolicy.xml 文件?您需要在此文件中启用跨域访问。请参阅此处 Making a Service Available Across Domain Boundaries
答案 1 :(得分:0)
您是否在Silverlight项目中使用ServiceReferences.ClientConfig文件?如果是,您是否检查了所有端点设置?