我試圖建立一個概念證明Csla 3.7/Silverlight 3應用程序,並已通過我的方式通過Rocky's tutorials。這是一個非常簡單的一種形式/一個業務對象數據編輯應用程序,並且一切都很好,直到我嘗試配置Wcf以便Silverlight應用程序可以與數據門戶進行通信。WCF/Csla地獄
我得到的錯誤是:
CommunicationException was unhandled by user code
An error occurred while trying to make a request to URI 'http://localhost:1406/WcfPortal.svc'.
This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services.
You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent.
This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute.
Please see the inner exception for more details.
我完全被這個迷惑,因爲我是一個有點的n00b的Silverlight的& WCF。我的設置對於Csla Silverlight應用程序來說非常簡單。我有4個項目:
- CslaSilverlight:Silverlight項目
- CslaSilverlight.Client:Silverlight的類庫
- CslaSilverlight.Server:.NET類庫
- CslaSilverlight.Web:ASPNET項目主辦SL應用
所有東西都在我的筆記本電腦上在卡西尼本地運行。我想讓DataPortal在Silverlight之外運行,以便可以訪問SQL Server。我認爲這個問題可能與我的WCF配置,其中在ServiceReferences.ClientConfig文件中指定的Silverlight應用程序:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IWcfPortal" maxBufferSize="65536"
maxReceivedMessageSize="65536" receiveTimeout="10" sendTimeout="10">
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:1406/WcfPortal.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWcfPortal"
contract="Csla.WcfPortal.IWcfPortal" name="BasicHttpBinding_IWcfPortal" />
</client>
</system.serviceModel>
</configuration>
我想知道如果端口號重要的是,當我改變它,我得到一個不同的錯誤。我也想知道端點地址的格式是否正確。
不知道它是很重要的,但是從ASPNET的web.config我serviceModel設置:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="WcfPortalBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="WcfPortalBehavior" name="Csla.Server.Hosts.Silverlight.WcfPortal">
<endpoint address="" binding="basicHttpBinding" contract="Csla.Server.Hosts.Silverlight.IWcfPortal">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
聽起來合乎邏輯。我按照你的建議google了,並且我已經在根文件夾中的ASPNET web應用程序中添加了一個clientaccesspolicy.xml文件,但它沒有任何作用! – Steve
我有我的直接在Web服務的.svc文件相同的位置。你有沒有找到它? – Andrew
doh!它的工作,只是一次...突然我現在得到 「遠程服務器返回一個錯誤:NotFound」 卡西尼已啓動並在端口3405上運行。我的端點地址是http:// localhost:3405/WcfPortal.svc – Steve