Silverlight WCF服务仅在本地主机上工作
很抱歉,我的帖子太长了,但我希望尽可能多地提供信息。因此,为了让我的WCF服务与我的silverlight应用程序正常工作,我已经苦苦挣扎了好几天。我最初部署了它,一切都很顺利 然而,在我对其中一个方法进行了更新之后,它就不再起作用了。我使用SVN存储我的工作,甚至返回到项目的早期版本,重新部署它也没有帮助。有人能帮我吗( 如果我通过VS2012运行silverlight应用程序,它将正常工作所有对服务的调用都将按要求工作并检索正确的信息。但是,如果我在部署silverlight应用程序后触发相同的调用,我将收到以下错误之一:Silverlight WCF服务仅在本地主机上工作,wcf,web-services,silverlight,iis,webservice-client,Wcf,Web Services,Silverlight,Iis,Webservice Client,很抱歉,我的帖子太长了,但我希望尽可能多地提供信息。因此,为了让我的WCF服务与我的silverlight应用程序正常工作,我已经苦苦挣扎了好几天。我最初部署了它,一切都很顺利 然而,在我对其中一个方法进行了更新之后,它就不再起作用了。我使用SVN存储我的工作,甚至返回到项目的早期版本,重新部署它也没有帮助。有人能帮我吗( 如果我通过VS2012运行silverlight应用程序,它将正常工作所有对服务的调用都将按要求工作并检索正确的信息。但是,如果我在部署silverlight应用程序后触发相
An exception occurred during the operation, making the result invalid. Check InnerException for exception details.
at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at OrionDashboard.OrionWebService.GetTestDataCompletedEventArgs.get_Result()
at OrionDashboard.MonthlyOverview.OrionWebService_GetTestDataCompleted(Object sender, GetTestDataCompletedEventArgs e)
at OrionDashboard.OrionWebService.OrionWebServiceClient.OnGetTestDataCompleted(Object state)
或
与其他错误消息的onComplete事件错误对应的其余错误
同样,这种情况仅在将其部署到服务器上的IIS时发生,并且仅在我重新部署更新后才开始发生
我使用了VS2012附带的WCF Storm和WCF Test Client来测试网络上部署的服务,所有合同都返回了,没有任何问题
以下是ServiceReferences.ClinetConfig:
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_OrionWebService">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://localhost:53493/OrionWebService.svc"
binding="customBinding"
bindingConfiguration="CustomBinding_OrionWebService"
contract="OrionWebService.OrionWebService"
name="CustomBinding_OrionWebService" />
</client>
</system.serviceModel>
我在引用服务项目时自动生成的内容中没有对此进行任何更改。我想可能是这一行:http://localhost:53493/OrionWebService.svc"
因为在fiddler中,我在crossdomain.xml和clientaccesspolicy.xml上收到以下错误
[Fiddler]到本地主机的套接字连接失败。
错误代码:10061。
无法建立连接,因为目标计算机主动拒绝它[::1]:53493
但是,当我将xap更改为zip文件并修改ServiceReference.ClientConfig以指向与您要检查服务时相同的服务地址时,例如。“http://ServerName/OrionDashboard/OrionWebService.svc“我仍然从silverlight中得到相同的错误,然后从这两个文件中得到404错误
以下是web.config文件:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true"
targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="OrionDashboard.Web.OrionWebService.customBinding0">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="OrionDashboard.Web.OrionWebService">
<endpoint address=""
binding="customBinding"
bindingConfiguration="OrionDashboard.Web.OrionWebService.customBinding0"
contract="OrionDashboard.Web.OrionWebService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
</configuration>
与ServiceReference一样,web.config也被单独留下,因为我不太明白它的大部分含义。但我在第一次部署silverlight应用程序时就这样留下了它,正如前面提到的那样,当时它工作得很好
- 我不认为这是一个数据库问题,因为它在本地运行,没有任何问题,并且服务也使用来自已部署服务的正确数据进行响应
- 该服务似乎工作正常,WCF测试客户端或WCF Storm应用程序均未报告任何问题
- 在VS2012中,发布wcf服务时,不会将服务与客户端分离,也不会创建crossdomain.xml或clientaccesspolicy.xml,因此我在发布后手动添加了这些内容。不确定这是否可能是原因
我完全迷路了,到目前为止,我找到的每一份工作都不适合我。请至少有人能给我指出正确的方向吗?有人吗?即使这只是另一篇文章的链接,我对你的文章也有同样的问题,但就像你一样,只有人读了它,但没有人来这里评论或回答。它看起来像WCF s服务只能在本地主机上运行。这是我在这个问题上的噩梦。
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true"
targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="OrionDashboard.Web.OrionWebService.customBinding0">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="OrionDashboard.Web.OrionWebService">
<endpoint address=""
binding="customBinding"
bindingConfiguration="OrionDashboard.Web.OrionWebService.customBinding0"
contract="OrionDashboard.Web.OrionWebService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
</configuration>