|
Hi, I have created a client - server application to be used for running tests ( e.g regression ). I decided to deploy both the client and server with click - once. For the first look, everything looks fine, the applications install. There is a problem once the server application is started. It is supposed to load a testing assembly ( .dll file ) that contains tests to be run. On the dll load I am getting the following error: "Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, ...... failed" Both the server and the client are deployed on a network share. Both have "This is a full trust application" option set. More things I observed: 1. If the server is deployed on my local machine and installed from this location, the problem does not occur. 2. If the server is installed from a network share, the problem occurs if the server was run from the shortcurt in "Start - All Programs.. ", however, If I go to the folder where the executable file resides: ".../user profile/local settings/apps/" and run the executable from that location, the problem does not occur. Can anyone help? Thanks | | t_barto Friday, September 04, 2009 2:54 PM | Hi, I'm fairly new to clickOnce, but I ran into the same thing on the same day you did. Here's what I did to fix it:
1. select <PROJECT> 2. select 'solution_name'<PROPERTIES> 3. select the SECURITY Tab 4. with the 'This is afull trust application' radio button selected, make a note of all the Permission items in which there appears the green circle with the check mark in it. 5. select the 'This is a partial trust application' button 6. in the 'Zone your application will be installed from' select (Custom) 7. select 'Include' in all the fields that they appeared as noted in step 4. and add the FileIOPermission
This worked for me on my remote machine. Hope it works for you. - Proposed As Answer byAland LiMSFT, ModeratorMonday, September 07, 2009 8:51 AM
- Unproposed As Answer byRobinDotNetMVP, ModeratorMonday, September 14, 2009 9:18 PM
-
| | FRtracer Sunday, September 06, 2009 8:32 PM | Hi, I'm fairly new to clickOnce, but I ran into the same thing on the same day you did. Here's what I did to fix it:
1. select <PROJECT> 2. select 'solution_name'<PROPERTIES> 3. select the SECURITY Tab 4. with the 'This is afull trust application' radio button selected, make a note of all the Permission items in which there appears the green circle with the check mark in it. 5. select the 'This is a partial trust application' button 6. in the 'Zone your application will be installed from' select (Custom) 7. select 'Include' in all the fields that they appeared as noted in step 4. and add the FileIOPermission
This worked for me on my remote machine. Hope it works for you. | | FRtracer Sunday, September 06, 2009 8:32 PM | FRtracer, Thanks a lot for the solution You proposed. I am already on vacation, but once I am back at the office ( next Monday ) I will give it a try, and let You know if that worked. Thanks. | | t_barto Monday, September 07, 2009 2:04 PM | Hi, I gave the solution a try, unfortunately it did not work. I was not able to install the application anymore - there was an exception like: "Failed to grant minimum permission requests". Thanks for Your effort. I have a couple more details about the problem, as I found it occurs in a third-party dll I am using in the project. This dll file is referenced in my project, and it is published by default. I do not have a control over the code that loads the tests, as this happens in the third party dll ( NUnit component ). Here is the message: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. and the stack trace: at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.Reflection.Assembly.VerifyCodeBaseDiscovery(String codeBase) at System.Reflection.Assembly.get_CodeBase() at NUnit.Core.AssemblyHelper.GetAssemblyPath(Assembly assembly) at NUnit.Core.NUnitConfiguration.get_NUnitLibDirectory() at NUnit.Core.DomainInitializer.InitializeDomain(TraceLevel traceLevel) at NUnit.Core.DomainInitializer.InitializeDomain(TraceLevel traceLevel) at NUnit.Util.DomainManager.CreateDomain(TestPackage package) at NUnit.Util.TestDomain.Load(TestPackage package) at NUnit.Util.TestLoader.LoadTest(String testName) Hope, somebody can help. | | t_barto Monday, September 14, 2009 5:16 PM | I'm not understanding exactly what's going on, so let me ask some questions. You have a client that you are deploying to a desktop using ClickOnce. You have a service (?) that you are deploying to a server using ClickOnce. I'm not sure what this part entails. Can you provide more information? Note that you can not use ClickOnce to install a Windows Service, or to install anything in the GAC. If I have more clarity, I may be able to help you. RobinDotNet Click here to visit my ClickOnce blog! | | RobinDotNet Sunday, September 20, 2009 6:56 PM | Hi, Here is what it looks like: 1. I have a client - server solution. Both the client and the server are deployed on a network shares ( separate locations ). They are published with "This is a full trust application" option. 2. Both the client and the server install correctly with Click - once. 3. Use case: a). Client connects to a server. Server provides client with the list of testing assemblies it allows to run. b). User ( client ) selects an assembly name and sends a request to the server. c). Server loads the testing assembly ( dll file ). The paragraph c) is where the exception occurs. The testing assembly load is performed in a third-party assembly which is referenced in my project. The details of the exception are available in the post above. Thanks for the interest. | | t_barto Monday, September 21, 2009 10:06 AM | Is the client a windows form application, a wpf application, or a console application? Is the server a windows form application, a wpf application, or a console application? RobinDotNet Click here to visit my ClickOnce blog! | | RobinDotNet Monday, September 21, 2009 11:26 PM | Hi, The client is a wpf application, however there are a couple of win forms components, that are hosted by windows forms host. The server is a pure wpf application. Thanks | | t_barto Tuesday, September 22, 2009 8:13 AM | How does the client connect to the server? Are you using interprocess communication? Why isn't the server a windows service or a web service or something like that; does it have UI? Who is running the apps? You said they are deployed to network shares. Is someone installing them and running them both, is that what's going on? I'm completely not understand how they interact and what each of them does on their own. RobinDotNet Click here to visit my ClickOnce blog! | | RobinDotNet Friday, September 25, 2009 3:14 AM | Hi, The communication is implemented over WCF. The server is a WCF service host, the client is a WCF service client. Both the applications have WPF UI. The service that is hosted by the server is used by us to run regression test and send the results back to clients. Client just allows user to run tests and presents the test results to him. To clarify how they interact, here is a use case: a. The server is installed on our testing machine ( let's call it Machine_A ) b. Users have clients installed on their machines ( let's call user machine : Machine_B ) 1. User needs to run tests. He starts the client that is installed on his machine, and connects to the server. So the clients from Machine_B connects to the server on Machine_A. 2. Server sends back to client an information about testing assemblies it is able to run. 3. User selects an assembly name he wants to run in his client application and clicks Start. This information is send from Machine_B to Machine_A 4. Server receives the information and loads the assembly with the name selected by user ( Actually the service that is hosted by the server does that ). And here is where the application crashes due to FileIOPermission exception. This problem occurs only if the server is installed with click once from a network share where it is deployed. If I would just copy the server application and put it in a folder on the server machine, then ran it from that location ( locally on the server ) the problem would not occur. Please, also take a look at a sample code, here is the server side
namespace Service{
public interface ITestService{
string GetAvailableAssembly();
void LoadTest(string assemblyName);
}
public class TestService: ITestService{
ThirdPartyDllObject _thirdPartyObject = new ThirdPartyDllObject();
string _avaliableAssembly = "TestingAssembly.dll";
//client calls this method to receive information of what assembly exists on server<br/>
public string GetAvailableAssembly(){
return _avaliableAssembly ;
}
//client calls this method to load testing assembly<br/>
public void LoadTest(string assemblyName){
_thirdPartyDllObject.LoadAssembly(assemblyName);
}
}
The _thirdPartyDllObject in the code above, is an object from a third party dll that is referenced in my project. | | t_barto Friday, September 25, 2009 10:09 AM | Okay, that was really helpful. I have a question -- are you publishing the server as a full trust application? RobinDotNet Click here to visit my ClickOnce blog! | | RobinDotNet Friday, September 25, 2009 9:20 PM | Yes, the server was published as a full trust application. | | t_barto Tuesday, September 29, 2009 11:50 AM |
|