Skip to main content
Hi,

I want to use SDK for Windows Sharepoint services in my k2 smart forms as i need to dynamically get the list of files uploaded to a document library in WSS. So to create a custom Web application within the context of a SharePoint deployment, I created an ASP.NET Web Application on sbs2003 server, in the _layouts folder of the WSS site (companyweb) so the url was like http://companyweb/_layouts/MBCK2Applications. But when i try to access the forms created in this folder from K2 workspace i get the following error:


Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unverifiable assembly 'K2OF' failed policy check.

Source Error: [No relevant source lines] Source File: machine.config Line: 358


I also tried creating a new asp.net web application in a new folder under WSS site. Not in the _layouts folder. But it gives me error as i try to create the web application in visual studio on a remote client. It gives an error "The ile path does not correspond to the URL. The two need to map to same server location. Http 404 Error"

But the virtual directory in the WSS site is linked to the directory.

Can anyone plase give me an idea how to solve this.

Reagrds
N
when i try to access the forms created in this folder from K2 workspace i get the following error
Please have a look at the following KB article:
http://kb.k2workflow.com/Articles/KB000068.aspx

Hope this helps,
Ockert

Thanks for your reply. But WSS and K2 2003 workspace are not even on the same machine. I have sbs2003 with WSS installed on it. I have another win 2003 server with K2 2003 installed on it.I have Keberoes enabled on these machines. Now from my client machine runnning Visual studio 2003 and K2 .net studio, I create a new web application under the WSS site in the _layouts folder, so that I can use the context of WSS in my K2 Smart forms. This gives the error.

Hope this makes it clear.


Thanx
N
It's definitely a security/permissions problem in WSS but to track it down can take a long time. Please open a formal support ticket on this issue.

Regards,
Ockert
Hi nfaz,

The error you recieve regarding the assembly failing the policy check is to do with a .net feature called Code Access Security.

Basically this allows you to create security policies around the code on your machine that stipulate specifcally what that code is allowed to do. For example, you might create a policy around a public facing web application that prevents any classes involved in file system access from being used. A full description of the levels and options available in CAS is a bit large for a forum post but if you wish to investigate it more... http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcodeaccesssecurity.asp

With regards to your specific issue, both WSS and Sharepoint Portal Server make good use of CAS, and by default all code running within them is subject to pretty stringent restrictions. This is the reason your application is failing, because the assembly K2OF does not meet those restrictions. (Note: This isn't to say that there is anything wrong with the K2OF assembly, bascially all assemblies fail the sharepoint security policies without a specific policy being applied, or being installed in the GAC.)

There are two likely solutions to hopefully resolve your situation:

1. Raise the restrictions. You can configure a higher 'trust' level for your code, that will allow the K2 asssemblies to run unobstructed by the .net framework security. You can also achieve this by instaling any required assemblies in the GAC.

2. Take the application outside of the WSS managed path structure. You only really need to build a web application inside the sharepoint managed structure if the web application is going to literally live within and directly interact with the existing sharepoint UI. If it is just accessing information within sharepoint, it is far easier to build and run it outside of sharepoint's overbearing management layer.

Generally I wouldn't recommend option 1 unless you have completely examined the security requirements of your solution and applied a specific policy to meet these requirements. Simply removing all security from a WSS installation by upping the security 'trust' policy is not a good practice as it can leave a large number of holes to be exploited.

I would recommend option 2 as it doesn't sound like your requirements would necessitate the added complexity of running inside the sharepoint structure. Following this option you then have a further choice to make, which is whether you would like the code to run on the same URL as sharepoint, or whether it can run under a different URL and therefore an entirely seperate virtual server.

If you use another seperate virtual server, that should be okay for you to set up. If you wish to run it on the same virtual server, you need to configure an 'excluded' path within sharepoint, which is also the cause of your second error regarding Visual Studio. Quick sharepoint primer...

When you 'extend' a virtual server with the sharepoint technologies, an ISAPI filter is installed on that virtual server, that filters every incoming request to that endpoint. The result is that the entire path structure of the website as works normally is ignored. Sharepoint will refer each incoming request to it's known structure of sites and subsites to see if the path requested matches one of those. If it doesn't it will return a 404 error EVEN if the path does actually physically exist within the file system or the IIS configuration. To make the sharepoint management layer take note of your manually configured paths, you must exclude them from the sharepoint configuration. This can be done under "Virtual Server Settings | Define managed paths." Once a path is excluded from sharepoint, it will operate almost as if it were a normal IIS directory (some other issues may crop up but that's for another post).

This is why Visual Studio compained because when it queries the web server for the path that you want to build your web application in, the server examines its sharepoint configuration, doesn't find a matching site or subsite path and so returns 404.

Hopefully that's given you some more insight in how to achieve what you want.

If you've got any further questions, or I haven't explained anything well enough, please let me know.

Thanks.

Adam.
I agree with Adam - Only create ASP.NET applications in the SPS structure if it is needed on all sites within SPS.

The problem is definitely related to the Trust level specified for SPS in the machine.config file. It is by default on WSS_Minimal which will deny any assembly without a strong name to execute. (You can lower the SPS security by modifying the machine.config file but this is not advised.)

If you really need to get a SmartForm to work then you can try to strong name the K2Of.dll.

Have a look at:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconworkingwithstrongly-namedassemblies.asp

and

http://kb.k2workflow.com/Articles/KB000113.aspx

The other option would be to use normal ASPX pages and use the K2ROM to connect to the K2.net Server. The K2ROM is already strong named and can be added to the GAC.

Hope this helps.
Hi,

Thankyou Adam and Conradk2 for your replies. Adam when I tried excluding my asp.net application from the sharepoint configuration, I could create a new asp.net project using Visaul Studio under the WSS site. But when i access the k2.net forms in this project, i get the same error.
Unverifiable assembly 'K2OF' failed policy check.

So if I follow your recommendation and create the applicatiion on a new virtual server, how can I us the context of the sharepoint site in the code. In order to do OM code against Sharepoint, does one need to be on the same virtual sever as sharepoint or one just need to be on the same server as Sharepoint on a different virtaul server.

Please advise me.

Regards,
N
Hi,

Is it possible that I create a web service on the sharepoint site and exclude it form the sharepoint configuration. I would then create my asp.net projects on the win 2003 server having K2.net server. The k2.net smart forms will then access the web service if they need any information from the Sharepoint site.

Will this work?. Or will sharepoint also block theh web service.

Please advise.

Regards
N
Hi Conradk2,

Thankyou for your help. I really appreciate it.
I tried following the steps you have mentioned in the Kb.
Here are the steps I tried out

1.
C:>ildasm K2OF.dll /out:K2OF.il
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// Disassembly of native methods is not supported.
// WARNING: Created Win32 resource file K2OF.res

2.
C:>sn -k c:K2OF.snk

Microsoft (R) .NET Framework Strong Name Utility Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Key pair written to c:K2OF.snk


3.
C:>sn -k c:K2OF.snk

Microsoft (R) .NET Framework Strong Name Utility Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Key pair written to c:K2OF.snk

C:>ilasm K2OF.il /dll /key=K2OF.snk

Microsoft (R) .NET Framework IL Assembler. Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Assembling 'K2OF.il' , no listing file, to DLL --> 'K2OF.DLL'
Source file is ANSI

K2OF.il(1042) : error : syntax error at token 'SourceCode.K2Utilities.Columns' i
n: .field public static valuetype SourceCode.K2Utilities._SPropTagArray_Columns
SourceCode.K2Utilities.Columns at D_00018040


***** FAILURE *****

So couldn't create a strongly typed dll for K2Of.dll. Any idea's why isn't it working.

Regards
N
Hi Nfaz,

I am not sure why you cannot create the strong name this way.

I would suggest that you rather use the K2ROM instead of using K2.net SmartForms in this case... This I know works...
Hi nfaz,

Sorry I never answered your question regarding the web service inside sharepoint.

You can deply custom web services inside sharepoint, and it isn't too difficult. The most significant aspect is that it will block access to the WSDL of the webservice, but of course there are workarounds.

An extreamly good article regarding custom webserivces inside sharepoint is here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_sp2003_ta/html/odc_WritingCustomWebServicesForSPPT.asp

Thanks.

Adam.

Reply