我的Web服务有问题,我需要帮助。 我有一个Silverlight项目和ASP部分Silverlight.Web。在Silverlight.Web中添加了一个Linq to SQL文件,一个用于验证用户登录的数据库,以及一个创建的服务,一个asmx文件。在Silverlight项目中,为我的asmx Web服务添加了一个服务引用。构建之后,创建了ServiceReferences.ClientConfig。当我运行我的项目时,该服务无法使用创建的ServiceReferences.ClientConfig文件:
如果我评论这部分 只有从VisualStudio运行我的项目才会起作用,但是如果在IIS上发布我的项目,那么该服务就无法正常工作。(我在ServiceReferences.ClientConfig中更改我的服务路径http://localhost/silverlight/UserLogin.asmx,我的服务已发布)我收到此错误:
错误:Silverlight应用程序中的未处理错误操作期间发生异常,导致结果无效。检查InnerException以获取异常详细信息。在System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() 在SilverlightPowerPoint.UserLoginService.UsersLoginCompletedEventArgs.get_Result() 在SilverlightPowerPoint.Login.uls_UsersLoginCompleted(Object sender,UsersLoginCompletedEventArgs e) at SilverlightPowerPoint.UserLoginService.UserLoginSoapClient.OnUsersLoginCompleted(Object state) 源文件:http://localhost/Silverlight/SilverlightPowerPointTestPage.aspx
如果我从我的IIS http://localhost/Silverlight/UserLogin.asmx运行服务,我会给出参数并且它有效,它会给我答案。
我该怎么办?
谢谢你, 安德烈
答案 0 :(得分:1)
ServiceReferences.ClientConfig文件:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="UserLoginSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security>
<transport>
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:50470/UserLogin.asmx"
binding="basicHttpBinding" bindingConfiguration="UserLoginSoap"
contract="UserLoginService.UserLoginSoap" name="UserLoginSoap" />
</client>
</system.serviceModel>
在我发表评论后,它有效:
<security>
<transport>
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
</security>