none
Accessing FAST Service Application Proxy outside of a SharePoint Context RRS feed

  • Question

  • Hello,

    I have a WCF service in which I have been trying to get access to a FAST Service Application Proxy to get hold of all the rank profiles but have run into some issues. Here is how I have tried to do this,

    foreach (SearchServiceApplication application in SearchService.Service.SearchApplications)
    {
        if (application.Name.Equals("FAST Query SSA"))
            fastProxy = application.FASTAdminProxy;
    }
    

    Ok the first problem is that I haven't been able to compile this. I have added a reference to "Microsoft.Office.Server.Search.Administration" but for some reason I am getting this error,

    "The type or namespace name 'Administration' does not exist in the namespace 'Microsoft.Office.Server.Search' (are you missing an assembly reference?)"

    The project is targetting .NET 3.5 so that is not an issue either.

    Secondly, I don't really know if this piece of code actually does work, and there is no way I can test it, so I am kind of stuck.

    Looking forward to someone helping me out here.

    Regards,
    Fahad

    Monday, June 27, 2011 1:59 PM

Answers

  • Hi Fahad,

    I don't think it's possible to do this at all. The reason is because the Context objects in the AdminProxy reads in WCF client configs from the file system on the SharePoint server. If you don't have access to these, then it just won't work. The same goes for the powershell commands on the FAST server which basically uses the same objects. But it will read the WCF config from the Admin service's .config file.

    If you want to use these outside of SharePoint I think you have to create a service in SharePoint which can proxy the calls for you.

    And the FAST versions of your Context objects are located in the .Extended dlls. the one in the regular SharePoint dll's which you tried to use is for the built-in SharePoint Search.

    That said, if you create your own client proxy code (which is what the .FASTAdminProxy property is all about), then you might be able to get it to work.

    Regards,
    Mikael Svenson 


    Search Enthusiast - MCTS SharePoint/WCF4/ASP.Net4
    http://techmikael.blogspot.com/
    Tuesday, June 28, 2011 7:02 AM

All replies

  • Hi Fahad,

    I use the following code to get access to the admin functions which work just fine:

    var ssaProxy = (SearchServiceApplicationProxy)SearchServiceApplicationProxy.GetProxy(SPServiceContext.Current);
    

    This will retrieve the default Query SSA.

    I have a blog post on working with managed/crawler properties via the FASTAdminProxy at http://techmikael.blogspot.com/2011/05/working-with-crawled-and-managed.html which might help you.

    Make sure you add references to the following namespaces:

    Microsoft.SharePoint.Search.Extended.Administration
    Microsoft.SharePoint.Search.Extended.Administration.Keywords

    and these dll's:
    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.SharePoint.Search.Extended.Administration.dll
    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.SharePoint.Search.Extended.Administration.Common.dll 

    Regards,
    Mikael Svenson 


    Search Enthusiast - MCTS SharePoint/WCF4/ASP.Net4
    http://techmikael.blogspot.com/
    Monday, June 27, 2011 7:16 PM
  • Thanks for the reply. The blog posts you have mentioned can be used to access the FAST admin proxy when you are inside the Sharepoint context and I have used the techniques before to good effect. The problem though is that right now I am trying to access these same FAST admin features outside the Sharepoint Context. The code I provided in the earlier post I run inside a WCF service deployed as a simple ASP.NET website.

    To add to it, I haven't been able to use the namespace "Microsoft.Office.Server.Search.Administration" as it generates an error when I try to build the web service. I have added a reference to "Microsoft.Office.Server.Search". I don't get an error from the VS2010 IDE while writing code; it's only when I build the website that I get this error,

    "The type or namespace name 'Administration' does not exist in the namespace 'Microsoft.Office.Server.Search' (are you missing an assembly reference?)"

    And I have no idea why this is happening.
    Monday, June 27, 2011 9:10 PM
  • Hi Fahad,

    I don't think it's possible to do this at all. The reason is because the Context objects in the AdminProxy reads in WCF client configs from the file system on the SharePoint server. If you don't have access to these, then it just won't work. The same goes for the powershell commands on the FAST server which basically uses the same objects. But it will read the WCF config from the Admin service's .config file.

    If you want to use these outside of SharePoint I think you have to create a service in SharePoint which can proxy the calls for you.

    And the FAST versions of your Context objects are located in the .Extended dlls. the one in the regular SharePoint dll's which you tried to use is for the built-in SharePoint Search.

    That said, if you create your own client proxy code (which is what the .FASTAdminProxy property is all about), then you might be able to get it to work.

    Regards,
    Mikael Svenson 


    Search Enthusiast - MCTS SharePoint/WCF4/ASP.Net4
    http://techmikael.blogspot.com/
    Tuesday, June 28, 2011 7:02 AM
  • Hi Mikael,

    Well I get what you are saying, makes sense but it's just that I read a couple of blog posts which said that you can possibly do this...here is one...

    http://blogs.technet.com/b/speschka/archive/2010/02/20/getting-search-service-applications-and-proxies-in-sharepoint-2010.aspx

    And it's not like I run my code and I am denied access. I am not able to compile it even so I thought it was probably something else. But I don't know...

    And also I am trying to access it through one of the farm users that has access to everything so I am just a bit perplexed as to why I am getting this assembly reference error. It would have made more sense if it was an access denied error or something.

    Tuesday, June 28, 2011 7:26 AM
  • Ok I ended up moving the WCF service inside Sharepoint and it works now.

    Thanks for the clarification.

    Tuesday, June 28, 2011 11:52 AM
  • That post refers to SharePoint built-in search, not FAST :) Guess they didn't have time to get it all in there.

    And the assemly error seems weird indeed, but I haven't had time to check it out (and most likely won't unless I encounter it myself ;)

    -m


    Search Enthusiast - MCTS SharePoint/WCF4/ASP.Net4
    http://techmikael.blogspot.com/
    Tuesday, June 28, 2011 12:10 PM
  • The post does mention how you can do it in FAST further down. But anyway it doesn't really make much of a difference as to how it's deployed in my case...so all is good.. :)
    Tuesday, June 28, 2011 3:11 PM
  • Hello,

    I read the post a bit quick. That post is about getting access to the ssa proxy object, not about using the admin context objects. And it says nothing of this at all :) And using FASTAdminProxy from the ssa proxy will not work outside of SharePoint (or outside the FS4SP server).

    -m


    Search Enthusiast - MCTS SharePoint/WCF4/ASP.Net4
    http://techmikael.blogspot.com/
    Wednesday, June 29, 2011 12:38 PM