我在使用ADO.NET Entity Data Model生成 * .edmx,然後利用Domain Service 生成服務。在Silverlight中調用服務中的方法。以上過程在VS2010中一切正常,當我想將程序部署在IIS6的時候,程序可以跑起來,但是怎麼也沒辦法獲得Sql server數據。總是提示“遠程服務器返回了錯誤: NotFound。”;
1:跨越xml已經添加在跟目錄;
2:系統所使用的dll均已拷貝紙Bin目錄下;
3:利用動態svc地址訪問http://localhost:8000/wcf/services/sl_WcfRia-web-hwDomainContext.svc無法獲得服務頁面,在VS2010運行環境範圍時可以訪問;
各位朋友,可否知道服務器上那裏設置出現了問題,到時svc服務在IIS上無法訪問的原因。等待大家的幫助,謝謝!
運行環境情況:
1:開發環境和服務器是一臺機器(系統:windows xp;數據庫:2005 Sql Server;IIS:5.1)
2:Web.Config 文件如下
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<customErrors mode="On"/>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="DomainServiceModule" preCondition="managedHandler" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
<system.web>
<httpModules>
<add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</httpModules>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="fooSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Silverlight RIA Services Class Library類庫使用
2:安裝frmwork4.0(2、3、4步應該開發時都應裝好的)
3:安裝Silverlight_4_Toolkit_April_2010.msi
4:建創網站的虛擬目錄
5:從開發機拷備System.ServiceModel.DomainServices.Hosting和System.ServiceModel.DomainServices.Server到生產機的C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL這個目錄
6:拷備clientaccesspolicy.xml文件到wwwroot目錄
7:從開發機拷備拷備System.ServiceModel.DomainServices.Hosting.OData和System.ServiceModel.DomainServices.EntityFramework到生產機 C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL這個目錄
8:配置IIS
(1):wev服務擴展->允許asp.netv4.0
(2):網站屬性->文檔->添加默認文檔(如:Investoday.Yankee.ThirdPartyTestPage.aspx)
(3):網站屬性->目錄安全性->把身份驗證只設置成啓用匿名方部,去掉集成windows身份驗證
(4):網站屬性->Asp.net->選擇Version版本爲4.0
(5):網站屬性->Http頭->點擊MIME類型->添加.xaml:application/xaml+xml和.xap:application/x-silverlight-app的映射
(6):重啓IIS->運行命令:iisreset
經過上述步聚,部署就可以成功(操作系統:windows 2003 sp2,windowsxp 均可)
解決問題是快樂的,分享經驗也是快樂