到的ProfileCommon任何引用导致的误差值不能为空。参数名:类型 [英] Any reference to profilecommon causes error Value cannot be null. Parameter name: type

查看:315
本文介绍了到的ProfileCommon任何引用导致的误差值不能为空。参数名:类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已搜查了两个星期,每天晚上,详尽阅读论坛主题,并尝试所有建议的解决方案无论多么古怪。就像是这个相同的问题很多很多的论坛主题的情况下,现场工作正常我的开发机器上。它可以部署没有任何错误。它从生产服务器的工作原理,并从数据库中读取数据,但是当它试图访问一个配置文件其与此错误崩溃。

I have searched for two weeks, every night, exhaustively reading forum threads and trying all suggested solutions no matter how outlandish. Just as is the case with the many many forum threads about this same issue, the site works fine on my development machine. It deploys with no errors. It works from the production server and reads data from the database, but when it attempts to access a profile it crashes with this error.

有若干员额说,选择或取消所谓的选项删除APP_ code.compiled文件,但显然这是一个Visual Studio 2005的选项。它是无处在Visual Studio 2010中找到许多帖子称,以确保APP_ code.dll是在我的bin目录present。这是present。我已经删除了APP_ code.compile手动档,看看是否能做出任何区别。我已经从4.0改变了目标框架到2.0和3.5。我已经完全删除了该网站在IIS中创建不同的文件夹有不同的名称,并以允许此precompiled网站是更新和使用固定命名和单页组件每个组合重新部署的站点。我已经包含到System.Web.Profile和System.Web程序和System.Web.Profile.ProfileCommon引用。我创建了一个新的,新的网站指定的.NET Framework V4.0和复制的web.config文件到我的应用程序,并重新创建我的个人资料条目,以确保我没有在沿途的配置文件插孔任何东西。我烧蜡烛,使用巫术的魅力。我祈祷。我已经毫不夸张地试图就有关这个错误对谷歌和必应的回报让前5页或每论坛主题每一个可以想象的建议。我已经了14天做的几乎没有,但试图让这个网站上来没有这个错误。

A number of posts say to check or uncheck an option called "remove app_code.compiled file" but apparently this was a Visual Studio 2005 option. It is nowhere to be found in Visual Studio 2010. A number of posts say to make sure the App_Code.dll is present in my bin directory. It is present. I've deleted the app_code.compile file manually to see if that made any difference. I've changed the target framework from 4.0 to 2.0 and 3.5. I've completely deleted the site in IIS, created a different folder with a different name and redeployed the site with every combination of "allow this precompiled site to be updatable" and "Use fixed naming and single page assemblies". I've included references to System.Web.Profile and System.Web and System.Web.Profile.ProfileCommon. I've created a new, fresh website targeting .net framework v4.0 and copied that web.config file to my application and recreated my profile entries to ensure that I didn't jack anything up in the config file along the way. I've burnt candles and used voodoo charms. I've prayed. I have quite literally tried every conceivable suggestion on every forum thread pertaining to this error on the first five pages or so of returns on both google and bing. I have spent 14 days doing almost nothing but trying to get this website to come up without this error.

一个帖子称,以确保有在bin目录中的APP_ code.dll的参考。我不知道该怎么做,因为它是动态创建的。

One post said to ensure there is a reference to the app_code.dll in the bin directory. I don't know how to do that, since it's created dynamically.

有没有人对此有什么新的想法?

Does anyone have any fresh ideas on this?

推荐答案

好吧,我一直在做大量的阅读和试​​验对这个话题,我想我已经收集和汇编足够的信息以帮助那些谁可能通过搜索这个错误跨越这个线程绊倒。我会做的仅仅是提供了通俗的解释,随后几个环节非常相关信息。

Okay, I’ve been doing a lot of reading and experimenting on this topic, and I think I’ve gathered and compiled enough information to be helpful to those who might stumble across this thread by searching for this error. What I will do is simply offer a colloquial explanation followed by several links to very relevant information.

有由Visual Studio支持两种不同的网页设计方法; Web应用程序和网站。这是2005年,2008年,和2010年的真正的设计原则,这种划分朵朵,显然,从一个事实,即Visual Studio 2003中只支持Web应用程序模型,这个模型是与Visual Studio 2005的发布改变了,那么为了使设计原则以previous版本保持一致,Web应用程序的方法加入到Visual Studio 2005创建为,显然,即使是受人尊敬的技术水平的开发人员在路上一个非常混乱的叉子。

There are two distinct web design methodologies supported by Visual Studio; web applications and web sites. This is true of 2005, 2008, and 2010. This division of design principles stemmed, apparently, from the fact that Visual Studio 2003 only supported the web application model and this model was changed with the release of Visual Studio 2005, then in order to make design principles consistent with previous versions, the Web Application methodology was added to Visual Studio 2005 creating a very confusing fork in the road for developers of, apparently, even respectable skill levels.

我就不详谈了关于这两个模型之间的差异。有大量的细节在这篇文章底部的链接。但我只想说的配置文件,不支持从使用Web应用程序功能的开箱。

I won’t go into great detail on the differences between the two models. There is plenty of detail in the links at the bottom of this post. But suffice to say that profiles are NOT supported out of the box using the web application functionality.

此外,为了使事情变得更加混乱,这是已经被绊倒了我,配置文件将不会与网站模式工作,要么,如果该网站是通过构建出版 - >发布除非网站菜单选项(可能)是pre-手动编译先那么pre-编译的DLL通过复制网站或FTP或者任何你使用复制过来。 pre-汇编,显然是通过命令行来实现的。我有一个关于如何做以下说明它的链接。但同样,我没有这个测试自己,所以我不知道如果它甚至帮助。

Furthermore, to make matters even more confusing, and this is what has been tripping me up, profiles will not work with the web site model either if the site is published via the Build -> Publish Web Site menu option unless (maybe) it is pre-compiled manually first then the pre-compiled dlls are copied over via "copy site" or FTP or whatever you use. Pre-compilation is, apparently accomplished via the command line. I have a link with instructions on how to do it below. But again, I haven’t tested this myself, so I don’t know if it even helps.

它配置文件不与构建工作的原因 - >发布部署网站的方法是,因为ProfileCommon类与您在Web配置定义配置文件属性动态生成的,当IIS动态编译你的页面的第一次被访问。如果你使用了构建 - >发布网站。选择它编译您的dll得很好,但它不会为你创建这个类

The reason it profiles don’t work with the Build -> Publish Web Site method of deployment is because the ProfileCommon class is built dynamically with the profile properties you define in the web config when IIS dynamically compiles your page the first time it is accessed. If you use the "build -> publish web site" option it compiles your DLLs just fine, but it does not create this class for you.

老实说,我不知道为什么在Build - >发布网站选项包含在首位的网站模式。从一切我读过,网站VS Web应用程序模型的极穴是使ASP.net体验更像是一个传统的web开发经验,你的文件可以机器和通过FTP上编辑服务器或可只需在服务器上进行编辑。是的,他们有他们的访问之前进行编译,但编译,设计,动态地发生,显然,如果你编译网站第一然后上传你编译它没有动态创建ProfileCommon类,因此有效地采取出来的一个的asp.net的方法来网站设计的强大功能。

Honestly, I’m not sure why the Build -> Publish Web Site option is included in the website model in the first place. From everything I’ve read, the very point of the Web Site vs Web Application model is to make the ASP.net experience more like a traditional web development experience, where your files can be edited on your machine and FTPed to the server or can simply be edited on the server. Yes, they have to be compiled before they are accessed, but that compilation, by design, happens dynamically, and, apparently, if you compile the site first then upload it you compile it without dynamically creating the ProfileCommon class and therefore effectively take away one of the great features of the asp.net approach to website design.

有一些职位的人们前preSS担忧其code的安全性,因为使用本网站的模型和他们的文件复制到服务器进行动态编译指与源$文件C $ c在一个precompiled状态坐在服务器上。不过,我只是不明白这一点,任何其他更传统的Web脚本语言如Perl或PHP,甚至是传统的ASP之间的差异。在这些语言中的code坐在那里一样脆弱。任何code是一个错误配置的服务器上的脆弱。此外,即使您的code编译,随技能黑客绕过一个配置好IIS服务器的安全性,并在你的源文件得到你同样可以让你的编译文件,然后刚刚经历ILDASM运行它们。所以,除非他们是专业混淆,有什么区别呢?

There are a number of posts where people express concerns over the security of their code, because using the web site model and copying their files to the server for dynamic compilation means the files with the source code sit on the server in a precompiled state. However, I just don’t see a difference between this and any other more traditional web scripting language like Perl, or PHP, or even classic ASP. In those languages the code sits out there just as vulnerable. Any code is vulnerable on a misconfigured server. Furthermore, even if your code is compiled, a hacker with the skill to circumvent the security of a well configured IIS server and get at your source files could just as well get at your compiled files then just run them through ILDASM. So unless they are professionally obfuscated, what’s the difference?

所以,从我发现,如果你想在你的asp.net网站上使用的配置文件,创建你的网站作为一个网站项目VS Web应用程序项目和它复制到你的服务器,而不是通过其发布的构建菜单。你也许能够pre-编译然后发布它(不知道那一个),但我知道,简单地复制它,并让它动态编译的作品。

So, from what I’ve discovered, if you want to use profiles on your asp.net website, create your site as a Web Site Project vs a Web Application Project and copy it over to your server instead of Publishing it via the build menu. You might be able to pre-compile it then publish it (not sure about that one) but I know that simply copying it and letting it dynamically compile works.

如果我失去了一些东西,还有另一种方式,我很想了解它。同时这里有一些令人难以置信的有用的链接。很多感谢5arx设置我的这条道路上:

If I’m missing something and there is another way, I’d love to read about it. Meanwhile here are some incredibly helpful links. Much thanks to 5arx for setting me on this path:

http://www.$c$crsbarn.com/post/2008/06/ASPNET-Web-Site-versus-Web-Application-Project.aspx

http://msdn.microsoft.com/en-us/library/ dd547590.aspx

http://msdn.microsoft.com/en-us/library/ ms227972.aspx

这篇关于到的ProfileCommon任何引用导致的误差值不能为空。参数名:类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆