开发者

Is my System Administrator crazy :-) Does ASP.NET MVC break when the server's Physical Path is in UNC format?

开发者 https://www.devze.com 2023-01-02 09:49 出处:网络
I\'m trying to get my company to move to ASP.NET MVC and away from classic ASP. I\'ve written some sample applications as proof-of-concept but now I\'m running into problems as I try to deploy these m

I'm trying to get my company to move to ASP.NET MVC and away from classic ASP. I've written some sample applications as proof-of-concept but now I'm running into problems as I try to deploy these mvc applications to my company's IIS7 server.

My System Administrator says that there is something in ASP.NET MVC that is preventing him from having a UNC path specified as the server's physical path to the site folder. This sounds ridiculous to me because (to my knowledge) the MVC Framework doesn't have any effect on this setting... nor does the code I write.

The bottom line is this: if any of my mvc applications are to be used for clients, they have to run on a server using a UNC physical path. Currently, the mvc apps will work when the server has a non UNC path... just not with a UNC path.

  1. Am I wrong to tell the System Admin that it isn't MVC that's mucking up his UNC paths?
  2. Is there I resource you guys know of that I can use to research this problem?

Edits:

The error that is showing up in the browser says:

Security Exception

An unhandled exception was generated during the execution of the current web request. Information regarding t开发者_StackOverflow中文版he origin and location of the exception can be identified using the exception stack trace below.

And the Stack trace showed:

[SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]

System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase) +0

System.Reflection.Assembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +42

System.Web.UI.Util.GetTypeFromAssemblies(ICollection assemblies, String typeName, Boolean ignoreCase) +145

System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) +73

System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) +111

System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) +279


.NET needs some additional help running on UNC paths. Usually, this stems from not 'trusting' the remote computer. Here is a KB article describing one such error in IIS.

MS KB article

Do a google search on IIS .NET UNC paths. You can find more than any of us could post about it as far as why you have to change configurations, why you have to set permissions, etc. No, you are not wrong in MVC mucking the paths, it is .NET in general that needs help with the paths. As you are running classic ASP (script based), you have not encountered any of these problems.


Well I'm not too sure but I know asp.net needs a valid UNC path (no \whatever\C$ but rather \whatever\share) when using functions like file.exist. As always you need to make sure your worker process account has the proper read/write access to the specified path. Lastly you should use some general troubleshooting to see if its not just the mvc app that's having problems.

One last thing, don't use MapPath. It returns an absolute address when given a relative address.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号