我在使用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 均可)
解决问题是快乐的,分享经验也是快乐