>>
最近刚开始学习WCF,从ms网站下了WCF Samples研究... 安装完了开始运行第一个demo,TechnologySamples\Basic\GettingStarted\CS\GettingStarted.sln,Sample由于是2005的,升级solution到2008,没问题,rebuild了一下OK,后来发现client和service项目的Target Framework都是2.0,奇怪怎么还能编译通过?困惑中... 先不管了,先跑起来看看吧,一运行client就报异常,OMG... The requested service, 'http://localhost/servicemodelsamples/service.svc' could not be activated. See the server's diagnostic trace logs for more information. Rebuild的时候已经发现service被部署到C:\Inetpub\wwwroot\servicemodelsamples下面了,单独访问了一下'http://localhost/servicemodelsamples/service.svc'就报了黄页晕, Stack Trace: [InvalidOperationException: The type 'Microsoft.ServiceModel.Samples.CalculatorService', provided as the Service attribute value in the ServiceHost directive could not be found.] System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +4189701 System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +516 System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +31 System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +498 [ServiceActivationException: The service '/servicemodelsamples/service.svc' cannot be activated due to an exception during compilation. The exception message is: The type 'Microsoft.ServiceModel.Samples.CalculatorService', provided as the Service attribute value in the ServiceHost directive could not be found..] System.ServiceModel.AsyncResult.End(IAsyncResult result) +4413209 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +183 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +205 System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +322 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64 搞不懂ms给的sample都跑不了,于是只能求助google,在msdn forums上找到了答案 Running: ...\TechnologySamples\Setup\CS\cleanupvroot.bat and then:...\TechnologySamples\Setup\CS\setupvroot.bat 一切OK,ms真会跟我们开玩笑呵呵...(责任编辑:admin) |