C# 我的Silverlight/WCF配置有什么问题

C# 我的Silverlight/WCF配置有什么问题,c#,asp.net,.net,wcf,silverlight,C#,Asp.net,.net,Wcf,Silverlight,我承认我已经挣扎了几个小时了。我的Silverlight应用程序和WCFWeb服务之间的绑定/配置肯定缺少一些内容。它工作了一段时间,但我一定是不小心改变了一些设置,我无法让它工作了 <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpEndpoint" closeTimeout="00:01:00" ope

我承认我已经挣扎了几个小时了。我的Silverlight应用程序和WCFWeb服务之间的绑定/配置肯定缺少一些内容。它工作了一段时间,但我一定是不小心改变了一些设置,我无法让它工作了

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                      <security mode="TransportCredentialOnly">
                        <transport clientCredentialType="Windows" />
                      </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://<<<ip_to_machine>>>/webserviceapp/Service1.svc" 
            binding="basicHttpBinding" 
            bindingConfiguration="BasicHttpEndpoint" 
            contract="ServiceReference1.IService1"
            name="BasicHttpEndpoint" />
    </client>
</system.serviceModel>
<system.webServer>
    <defaultDocument>
        <files>
            <add value="ProjectTestPage.html" />
        </files>
    </defaultDocument>
</system.webServer>
在Visual Studio中,当我调试时,我同时启动了服务和Silverlight应用程序,我在web.config文件中禁用了Windows身份验证以进行调试。部署时,我返回并更改配置文件以启用Windows安全/传输,以便在web服务端获取用户凭据

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                      <security mode="TransportCredentialOnly">
                        <transport clientCredentialType="Windows" />
                      </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://<<<ip_to_machine>>>/webserviceapp/Service1.svc" 
            binding="basicHttpBinding" 
            bindingConfiguration="BasicHttpEndpoint" 
            contract="ServiceReference1.IService1"
            name="BasicHttpEndpoint" />
    </client>
</system.serviceModel>
<system.webServer>
    <defaultDocument>
        <files>
            <add value="ProjectTestPage.html" />
        </files>
    </defaultDocument>
</system.webServer>
现在,当我使用IIS将WCF服务和Silverlight应用程序部署到另一台机器上时,当Silverlight尝试联系WCF服务时,我收到一个错误“Not Found”。有人能给我解释一下存在的不同配置文件以及每个文件应该指向什么吗?以下是我在各自位置的配置文件:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                      <security mode="TransportCredentialOnly">
                        <transport clientCredentialType="Windows" />
                      </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://<<<ip_to_machine>>>/webserviceapp/Service1.svc" 
            binding="basicHttpBinding" 
            bindingConfiguration="BasicHttpEndpoint" 
            contract="ServiceReference1.IService1"
            name="BasicHttpEndpoint" />
    </client>
</system.serviceModel>
<system.webServer>
    <defaultDocument>
        <files>
            <add value="ProjectTestPage.html" />
        </files>
    </defaultDocument>
</system.webServer>
wwwroot\webserviceapp\web.config

<?xml version="1.0" encoding="UTF-8"?>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                      <security mode="TransportCredentialOnly">
                        <transport clientCredentialType="Windows" />
                      </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://<<<ip_to_machine>>>/webserviceapp/Service1.svc" 
            binding="basicHttpBinding" 
            bindingConfiguration="BasicHttpEndpoint" 
            contract="ServiceReference1.IService1"
            name="BasicHttpEndpoint" />
    </client>
</system.serviceModel>
<system.webServer>
    <defaultDocument>
        <files>
            <add value="ProjectTestPage.html" />
        </files>
    </defaultDocument>
</system.webServer>

我看得很清楚,没有错误。

我认为答案很简单。我收到的错误是一个非常普遍的错误。在这种情况下,正确的做法是使用Fiddler,它会准确地告诉您错误是什么。在我的例子中,由于服务加载不正确,跟踪日志记录无法正常工作。然而,Fiddler能够给我准确的异常消息,这使我能够快速轻松地解决问题。

我没有阅读所有这些,但是您是否考虑过使用跟踪日志记录或使用Fiddler来获取更多详细信息?请参阅和。我返回并在所有web.config文件中启用了跟踪日志记录,但从未生成任何日志文件。你知道为什么吗?你的跟踪日志设置有问题,或者你的服务永远不会被点击。你试过Fiddler吗?好吧,你强迫我用Fiddler,它告诉了我确切的错误!非常感谢你。
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                      <security mode="TransportCredentialOnly">
                        <transport clientCredentialType="Windows" />
                      </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://<<<ip_to_machine>>>/webserviceapp/Service1.svc" 
            binding="basicHttpBinding" 
            bindingConfiguration="BasicHttpEndpoint" 
            contract="ServiceReference1.IService1"
            name="BasicHttpEndpoint" />
    </client>
</system.serviceModel>
<system.webServer>
    <defaultDocument>
        <files>
            <add value="ProjectTestPage.html" />
        </files>
    </defaultDocument>
</system.webServer>
http://ipaddress/webserviceapp/Service1.svc