From: | Rick Strahl |
To: | Rick Garcia |
By default ASP.NET can't execute on a network share. If you use a network share you need to set the permissions for the remote machine(s). Also your application pool has to be configured to run under an account that has access to that remote share and virtual path location.
What version of .NET are you using? If using .NET 2.0 you'll definitely have to set the security policy for .NET to allow the remote share. If you are using .NET 4.0 this may not be necessary as the CAS security has been relaxed somewhat in .NET 4.0, but I'm not sure if that'll work as is or still requires CAS permissions to be set.
For .NET 2.0: (mscorcfg is part of the .NET 2.0 SDK)
- Run mscorcfg.msc.
- Go to:
- .Net Framework 2.0 Configuration
- My Computer
- Runtime Security Policy
- Machine
- Code Groups
- All_Code
- Right-click All_Code and select "New..."
- Give it some name and click Next.
- For the condition, choose "URL" and enter "\\<server>\<share>\*" for the URL. Click Next.
- Select the "Full Trust" Permission Set. Click Next then Finish.
+++ Rick ---
Windows 2008 R2 IIS 7 issue:
I am getting the following message when I have the wconnect virtual folder point to a remote UNC shared folder on a NAS device \\iwd\wwwroot\wconnect. I can get to this folder find from explorer.
FYI, I works perfect if the virtual runs from C:\INetPub\WWWRoot\Wconnect.
The app pool is set to run as the domain admin and so it the virtual path credentials
Any assistance would be appreciated!
*********************************
Server Error in '/wconnect' Application.
--------------------------------------------------------------------------------
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName) +0
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +64
System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +58
System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +65
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +342
System.Web.Configuration.HandlerFactoryCache.GetHandlerType(String type) +21
System.Web.Configuration.HandlerFactoryCache..ctor(String type) +19
System.Web.HttpApplication.GetFactory(String type) +78
System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +229
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
*********************************************
Here is my web.config which is in the remote UNC folder
*********************************************
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="webConnectionVisualStudio" type="System.Configuration.NameValueSectionHandler,System,Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<section name="webConnectionConfiguration" type="System.Configuration.NameValueSectionHandler,System,Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<section name="webConnectionErrorPages" type="System.Configuration.NameValueSectionHandler,System,Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</configSections>
<webConnectionVisualStudio>
<!-- Configuration Settings for the Web Connection Visual Studio Add-in
Not used at runtime, only at the design time -->
<add key="FoxProjectBasePath" value="c:\wconnect\"/>
<add key="WebProjectBasePath" value="\\IWV\wwwroot\wconnect\"/>
<add key="WebProjectVirtual" value="http://localhost/wconnect"/>
<!-- Optional PRG launched when VFP IDE launches -->
<add key="IdeOnLoadPrg" value=""/>
<!-- The default browser used. Blank IE Automation, otherwise specify browser exe path -->
<add key="WebBrowser" value=""/>
<add key="WebBrowserAlternate" value="C:\Program Files (x86)\mozilla firefox\firefox.exe"/>
<!-- The editor used to edit FoxPro code - blank means FoxPro Editor is used -->
<add key="FoxProEditor" value=""/>
<add key="_FoxProEditorAlternate" value="C:\Program Files (x86)\pspad editor\pspad.exe"/>
</webConnectionVisualStudio>
<webConnectionConfiguration>
<!-- NOTE: These settings apply only to the Web Connection Managed Module! -->
<add key="Timeout" value="60"/>
<add key="PostBufferLimit" value="0"/>
<add key="TempPath" value="C:\temp\wc\"/>
<add key="TempFilePrefix" value="WC_"/>
<add key="MessagingMechanism" value="File"/>
<add key="AdminAccount" value="ANY"/>
<add key="AdminPage" value="~/admin/admin.aspx"/>
<add key="ExeFile" value="c:\wconnect\wconnect.exe"/>
<add key="UpdateFile" value=""/>
<add key="LogDetail" value="False"/>
<add key="ValidateRequest" value="False"/>
<add key="ComServerProgId" value="wconnect.wconnectServer"/>
<add key="ComServerLoadingMode" value="LoadBased"/>
<add key="ServerCount" value="2"/>
<add key="AutoStartServers" value="False"/>
<add key="MessageDisplayFooter" value="Message generated by Web Connection IIS Connector Module"/>
</webConnectionConfiguration>
<webConnectionErrorPages>
<!-- NOTE: These settings apply only to the Web Connection Managed Module! -->
<add key="Exception" value=""/>
<add key="OleError" value=""/>
<add key="Timeout" value=""/>
<add key="NoOutput" value=""/>
<add key="Busy" value=""/>
<add key="Maintenance" value=""/>
<add key="InvalidRequestId" value=""/>
<add key="TranmitFileFailure" value=""/>
<add key="PostBufferSize" value=""/>
</webConnectionErrorPages>
<system.web>
<compilation defaultLanguage="c#" debug="true">
<!-- Build Providers enable your script extensions to be editable in Visual Studio -->
<buildProviders>
<add extension=".wcsx" type="System.Web.Compilation.PageBuildProvider"/>
<add extension=".wc" type="System.Web.Compilation.PageBuildProvider"/>
<add extension=".wwd" type="System.Web.Compilation.PageBuildProvider"/>
</buildProviders>
</compilation>
<!-- Web Connection Managed Module requires that it runs in FULL TRUST (COM Interop) -->
<trust level="Full"/>
<httpHandlers>
</httpHandlers>
</system.web>
<!-- IIS 7 Script Map Configuration -->
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name=".wc_wconnect-module" path="*.wc" verb="*" type="Westwind.WebConnection.WebConnectionHandler,WebConnectionModule" preCondition="integratedMode"/>
<add name=".wcs_wconnect-module" path="*.wcs" verb="*" type="Westwind.WebConnection.WebConnectionHandler,WebConnectionModule" preCondition="integratedMode"/>
<add name=".wcsx_wconnect-module" path="*.wcsx" verb="*" type="Westwind.WebConnection.WebConnectionHandler,WebConnectionModule" preCondition="integratedMode"/>
<add name=".wwsoap_wconnect-module" path="*.wwsoap" verb="*" type="Westwind.WebConnection.WebConnectionHandler,WebConnectionModule" preCondition="integratedMode"/>
<add name=".wwd_wconnect-module" path="*.wwd" verb="*" type="Westwind.WebConnection.WebConnectionHandler,WebConnectionModule" preCondition="integratedMode"/>
<add name=".blog_wconnect-module" path="*.blog" verb="*" type="Westwind.WebConnection.WebConnectionHandler,WebConnectionModule" preCondition="integratedMode"/>
</handlers>
<!--
*** ExtensionLess URL handling ***
* Requires Url Rewrite Module 2.0 is installed
-->
<!--
<rewrite>
<rules>
<rule name="ExtensionLessUrls" patternSyntax="Wildcard" stopProcessing="true">
<match url="*.*" negate="true" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="UrlRewriteHandler.wwd" appendQueryString="true" />
</rule>
</rules>
</rewrite>
-->
</system.webServer>
</configuration>
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.5472; ASP.NET Version:2.0.50727.5471
Rick Strahl
West Wind Technologies