I have a plain .Net based WCF Service which is interacting with SharePoint (2010) Site. I need to deploy it on the Production environment which is not a SharePoint environment. After creating and deploying the solution its giving error
"Could not load file or assembly 'Microsoft.SharePoint.Library, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified "
Please help me with the steps to create a deployment package for NON-SharePoint Environment.
Thanks
Yamini
If you are deploying your WCF on non-Sharepoint environment, You cannot use Sharepoint server object model inside wcf.
You need to use Client object model and add reference to Microsoft.Sharepoint.Client and Microsoft.Sharepoint.Client.Runtime
Related
I've had not a lot of luck creating a WCF service with Visual Studio. It's in IIS, and it I click 'browse' on the .svc file itself, it tells me I have created a service. So I assume it's all okay to a point.
Throughout my time I came across a recommendation to use a program called svcutil.exe. I used it on my service and got the following error. I don't know what it means, so hopefully someone can shed some light on the situation.
Here's the result:
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation. All rights reserved.
Attempting to download metadata from 'http://localhost/EvalServiceSite/Eval.svc'
using WS-Metadata Exchange or DISCO.
Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.Se
rviceModel.Description.DataContractSerializerMessageContractImporter
Error: Schema with target namespace 'http://tempuri.org/' could not be found.
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://tempuri.org/'
]/wsdl:portType[#name='IEvalService']
Error: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is de
pendent on.
XPath to wsdl:portType: //wsdl:definitions[#targetNamespace='http://tempuri.org/
']/wsdl:portType[#name='IEvalService']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://tempuri.org/'
]/wsdl:binding[#name='BasicHttpBinding_IEvalService']
Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is depend
ent on.
XPath to wsdl:binding: //wsdl:definitions[#targetNamespace='http://tempuri.org/'
]/wsdl:binding[#name='BasicHttpBinding_IEvalService']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://tempuri.org/'
]/wsdl:service[#name='EvalService']/wsdl:port[#name='BasicHttpBinding_IEvalServi
ce']
Generating files...
Warning: No code was generated.
If you were trying to generate a client, this could be because the metadata docu
ments did not contain any valid contracts or services
or because all contracts/services were discovered to exist in /reference assembl
ies. Verify that you passed all the metadata documents to the tool.
Warning: If you would like to generate data contracts from schemas make sure to
use the /dataContractOnly option.
I think this previous Stack Overflow question may help with your current question but not necessarily your problem.
Error: Cannot import wsdl:port with svcutil
You've created your WCF service and you've browsed to it in IIS so you're happy that it is working. The purpose of SVCUtil.exe is to generate classes that you can use in an application to interact with the service with compile time information on the contract members and methods.
it performs the exact same function as adding a service reference in visual studio to consume the service.
If your having trouble, i'd suggest just creating a simple console project in visual studio, adding a service reference and giving it the url of the service you've hosted in IIS. Then click "show all files" in the visual studio solution explorer and look at the reference.cs file it gives you. This will show you what information has been consumed from your service.
Edit
Hi Again,
After going through all the comments below I'm starting to see more about your problem. I think you misunderstand what it is your doing when in fact you've already achieved what you want to achieve.
The original project, the one you had with the WCF test client that worked did what you needed. It is a fully fledged WCF Service. All you needed to do was right click the solution in visual studio and publish it. If you then make sure that you make an IIS virtual directory point at your solution, through the publish wizard. Then when you run your project and then browse to that url, that will give you a service to consume for testing purposes.
What you are doing at the moment, creating a WCF project, adding that DLL to a website project is fundamentally wrong: The example you followed, presumably this one :
http://msdn.microsoft.com/en-us/library/ms733766.aspx
is about creating a WCF service in a web site project from scratch. Not about adding a pre-existing WCF project and hosting it.
Your essentially trying to do one thing in two different ways together.
Your current course of action is to either remove the DLL in your web project and then create the service there. Or host your current WCF service in IIS ( the project you downloaded from me or your original one)
At this point you have a hosted service. Then usually you have an application to interact wtih it. This you found using svcutil and can be done in one of two ways:
You create the console application and do "Add Service Reference" to the URL you have hosted in IIS.
Or you use SVC Util.exe point it at the url which generates a class file you include in your console / application.
I hope that clears things up about WCF and what stages to use various tools?
Edit 2
Just in case you don't get to the Chat:
I still think theres something wrong with your original project. I'm not sure what you mean by the one with the DLL either? if that means your website project with the dll of the WCF project, then no not that one.
I've taken the project I sent you earlier. I've hosed that in IIS so that when i browse to localhost/EvalService on my machine i get the standard
"EvalService Service
You have created a service.
To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:"
Once I had that set up i created a console application, "added service reference" in visual studio and it consumed teh service no problem.
Try doing the above with the project I sent you and see how far you get.
I am trying to host a custom web service in SharePoint 2007 (WSS 3.0) and so far I have followed the instructions here to create a simple 'Hello World' web service: Create WSS Web Service
However, when i get to the virtual path bit in step 4 I am struggling to see in visual studio how I create this and then deploy to make a virtual path to make my web service accessible.
Can anyone help me sort out creating a virtual path for WSS or point me in the direction of another guide to create and host a web service in SharePoint?
Thanks in advance...
You need to register the module in the web.config under configuration/system.web/httpModules.
<add name="ArbitraryName" type="Namespace.ClassName, AssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXX" />
Then you can put it in any directory you'd like. If you're using WSS 3.0 check to see if the previous virtual path provider has a name of "SPVirtualPathProvider". If you're using MOSS 2007 check to see if it has a name of "CmsVirtualPathProvider".
Daniel Larson does a decent job of walking you through it in Chapter 11 in his book Developing Service-Oriented AJAX Applications on the Microsoft Platform.
The best way to do this is normally a FeatureEventReceiver using the SPConfigModification class. This way it pushes out to all the servers in your farm.
You can host a web service in a _layouts folder for example. Just create some folder there (like "MyService"), put your .asmx, then put your web service .dll in GAC (don't use code behind). Restart IIS and you service would be available at http:///_layouts/MyService/.asmx.
I'm working with a WCF service in Azure, which uses Windows Live ID authentication with the recent deviceid requirements. When I host my WCF service locally in the compute emulator, it works properly, but when I deploy the cloud service to Azure and call it the same way (from another project that uses the WCF service as a service reference), I get the error:
Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I found this post : http://social.msdn.microsoft.com/Forums/en-US/netservices/thread/cd139b5c-ad12-4298-af2f-1b2d0136a977
But there are a few problems:
1. I don't seem to have access to Microsoft.IdentityModel, only System.IdentityModel. I'm not sure why it's searching for something in 3.5 at all, as I'm building in .NET 4.0.
2. When I choose to "copy to local" on System.IdentityModel, it doesn't change anything.
Any help? I would appreciate it!
Best Regards,
Andy
The answer to this question is here: http://social.microsoft.com/Forums/en-US/crm2011beta/thread/951f97df-77b8-4659-8032-6a71161a730c.
The CRM 2011 Beta SDK (versions after Dec. 15th) have some helper code that registers the deviceid on Azure. If you're not working with Microsoft Dynamics CRM 2011, the helper code can still be used to help you see how it's done.
I am creating solution and inside I have three projects:
A WCF Service Library Project
A DataAccess Project (Class Library)
A Web site for hosting WCF service
The implementation of the service is on the project # 1, but in order to access the DataBase I use a second project that implements the data access using a class library project.
That problem is in order to get data access I need to configure a connection string, but that connection string must be configurable in a production environment, I meant in production I am going to deploy the site, which is a very simple project that contains only a reference WCF Service Library Project then a guy from database department will configure the connection string.
In development I have an app.config on the data access project but when I do the release that app.config is embedded on the dll.
Any ideas how can we achieve our purpose
The connection string must be in the application configuration file of the executing assembly. This means that you can provided the configuration file for your assembly along with the assembly itself but anyone who wants to use your assembly must update their configuration file to include the values that your assembly relies on.
The connection string in your app.config (data layer) is not embedded in the dll.
If you look in the app.config file in your data layer project, you will probably have a connectionStrings section. you need to put the connectionStrings in the web.config of your WCF service website.
This can be configured in your production environment.
I had a mistake, I was using a different name on the web.config of the WCF site, I just copy the the exact part of the app.config to the web.config and its working now.
Thanks for your help
It seems the world is awash with people having problems deploying RIA WCF services, and now I'm one too. I've already tried a bunch of things, but to no avail. I need WCF RIA to support a Silverlight 3 application I've built.
The short story is, using the new WCF RIA services (Nov 09?) I open VS 2008, create new project (silverlight application), enabling ".NET RIA services". Add new item to web project - Linq2SQL dbml file (from SQL 2005 DB prepared earlier) and compile. I add a new item to the web project - domain service (link the tables I need) and compiled. Using the domain context I "Load" data with a standard RIA get query in the MainPage and add a TextBlock to display returned data. Build & run (cassini) - success. Using VS to publish to IIS on local PC - success.
Using VS to publish to test server (IIS6) - browse to location and the Silverlight app loads but Fiddler tells me I've got a 404 on all the the WCF .svc requests. Use Fiddler to "launch IE" on the service request and it's true - 404.
I have already run aspnet_regiis, ServiceModelReg and added mime types for .xap, .xaml, .xbap and .svc. I have included the System.Web.Ria and System.Web.DomainServices DLL with copy local true.
I need help with either
a) a solution
b) an approach to find a solution
I had some troubles with this also, although once I figured them out it's relatively straight forward.
First, run through http://timheuer.com/blog/archive/2009/12/10/tips-to-deploy-ria-services-troubleshoot.aspx (although it seems you have most of that covered off).
Check that you have your DomainServiceModule in the web.config in the new system.webServer bit and the old bit for IIS6:
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="DomainServiceModule" type="System.Web.Ria.Services.DomainServiceHttpModule, System.Web.Ria, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpModules>
Finally, I had to create my services manually, by creating .svc files where SL is looking for them (from fiddler) and filling them in with:
<%# ServiceHost Service="NameOfSerice" Factory="System.Web.Ria.DomainServiceHostFactoryEx" %>
Make sure that you also visit the .svc file directly (without the /binary on the end) as you can get some nice errors there (well once you solve your 404 of course!)
HTH,
Jordan.
I fought this issue for a little while myself where it could not find the .svc file. I soon realized it wasn't just my .svc, it was all .svc files. It then appeared to be an IIS6 issue. It turns out that the ASP.NET v4.0x Web Service Extensions are set to "Prohibited" by default. Went into Web Service Extensions config and set ASP.NET v4.0x to "Allowed" and life was all good.
I ran into the same problem. Worked fine with the cassini server under Windows 7. Deployed to Windows Server 2008 R2 with IIS7, and it would not work. Fiddler reported that an 'EndPointNotFoundException' was being thrown.
My solution, since I have full control of the server, was to install Visual Studio 2008 Express, Silverlight 3 SDK, and the WCF RIA Services Beta for VS2008. This meant that the necessary DLLs were already installed in the GAC. I don't think this affected the result, but I turned off 'Copy Local' for the RIA DLLs that were referenced by the Web app.
Probably an unorthodox solution, but it worked for me!!! Actually, I did this at the suggestion of Microsoft Support.
By the way, support for this through Microsoft is very sparse at this time. They are actually trying to figure out right now internally who is going to support this technology: WCF team or Silverlight team. I know it's still in beta, but be warned that a 'GoLive' license doesn't mean its fully supported. I had someone from the WCF team who went out of his way to help me on this, but gave me a disclaimer several times during the call, that it wasn't really supported through those channels yet.
If someone is interested, how to deploy a complete Silverlight solution to IIS with your own batch script, read my answer in this post:
Is there a Management Service (WMSVC) UI in IIS 7 on Windows 7?
I did this, because there was no way, the in-bulit webdeploy feature of VS 2010 was working. The batch script makes it possible, that you can run and debug on IIS.
I know, this is not the explicit answer to this question, but it is a very similar question.
I think you would only use FactoryEx if you extended the Factory as described here. Also, according to my help files, the full name is System.Web.Ria.Services.DomainServiceHostFactory, but the parser can't create that type either, although I have System.Web.Ria in the GAC.
I agree - deploying WCF RIA over https is a challenge - I have yet to get it to work.