2

To simplify this test case, I created a new default .NET MVC project in Visual Studio 2010, and added the following code to the HTML header in Site.Master:

<script type="text/javascript" src="../../Scripts/jquery-1.4.1.js"></script>
<script type="text/javascript">
  jQuery(document).ready(function () { alert('jQuery document ready'); });
</script>

This works as expected in the .NET development server. However, when deployed to IIS7, the jQuery(document).ready function is not executed. Needless to say, my actual application is much more complicated. This eliminates all "suspects" except IIS7 deployment.

Any thoughts/suggestions?

4

1 に答える 1

3

これはおそらく、次のsrc参照が原因です。

src="../../Scripts/jquery-1.4.1.js"

次のように置き換えます。

src="<%=Url.Content("~/Scripts/jquery-1.4.1.js")%>"

サイトが仮想ディレクトリにデプロイされている場合は、おそらくこれが当てはまります。

于 2010-04-26T17:25:01.363 に答える