2012-02-17 103 views
3

我正在尝试调用Web服务几个小时。 我已经加入clientaccesspolicy.xml:远程服务器返回错误:NotFound。 Silverlight + WCF

<?xml version="1.0" encoding="utf-8"?> 
<access-policy> 
    <cross-domain-access> 
    <policy> 
     <allow-from http-request-headers="*"> 
     <domain uri="*"/> 
     </allow-from> 
     <grant-to> 
     <resource path="/" include-subpaths="true"/> 
     </grant-to> 
    </policy> 
    </cross-domain-access> 
</access-policy> 

和crossdomain.xml的:

<?xml version="1.0"?> 
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> 
<cross-domain-policy> 
    <allow-http-request-headers-from domain="*" headers="SOAPAction,Content-Type"/> 
</cross-domain-policy> 

根我的网站的目录。 从IIS调用Web服务,它在这里工作。

但是,当我试图调用从Silverlight应用程序我的WCF Web服务我得到这个错误:

远程服务器返回错误:NOTFOUND。

这是日志从小提琴手:

a:InternalServiceFaultThe server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

这是代码,当我得到一个错误:

public int EndUserExist(System.IAsyncResult result) { 
     object[] _args = new object[0]; 
     int _result = ((int)(base.EndInvoke("UserExist", _args, result))); //Here 
     return _result; 
      } 

我在做什么错?

+0

验证您的端点配置是否正确。如果您使用基于wsdl的Visual Studio构建的代理类,您还可以检查它是否正确定义(尤其是,如果它包含UserExist方法并使用适当的参数) – 2012-02-17 21:44:06

回答

0

好吧;) 现在工作。 我打开了web.config中的调试,所以我得到了Fiddler中的异常消息。 我需要在IIS上为sql数据库设置标识用户。

9

查看您的web.config文本:IncludeExceptionDetailInFaults 将其设置为true。然后再次运行你的服务请求,看看Fiddler这次会告诉你你需要知道什么。 可能是从SQL错误到空引用的任何内容。 :-)

+0

更重要的是,我使用sql连接创建了一个简单的项目,字符串到这个sqlConn,它没有任何麻烦开放... – ogrod87 2012-02-17 22:14:31

0

在您的移动设备中,转到WiFi设置并编辑当前的无线连接。 设置代理“自动检测设置”。

相关问题