16

IIS7 Express (ローカル開発マシン上) を使用して新しい ASP.NET MVC3 を構成し、カスタムドメインを使用しようとしています。

例えば。

  1. 私のローカル開発マシン。
  2. Web ブラウザを開きます
  3. http://dev.www.mydomain.comに移動
  4. Visual Studio の MVC プロジェクトが始動

ホストファイルをハッキングして含めるようにしました(はい、ファイルを保存しました..つまり、管理者権限を有効にする必要がありました...

127.0.0.1 dev.www.mydomain.com

IIS7 Express を使用してこれを行うように構成する方法がわかりません。

私は行ってMVC Project => Properties => Web、次のことを行いました:- ここに画像の説明を入力

次に、サイトを実行しようとしました... ここに画像の説明を入力

誰でも助けることができますか?

4

2 に答える 2

19
  1. 現在実行中のサイトが実行されている場合は停止します

  2. %userprofile%\documents\iisexpress\config\applicationhost.config
    VS2015 +用にオープン:$(solutionDir)\.vs\config\applicationhost.config

  3. 興味のあるサイトを見つけてください。

    <binding protocol="http" bindingInformation="*:<your-port-number>:localhost" />

  4. <binding protocol="http" bindingInformation="*:<your-port>:dev.www.mydomain.com" />次に、上記のbindigエントリのすぐ下に同様のエントリを追加します。

  5. サイトを再度実行する

注:ローカルホスト以外のバインディングには管理者権限が必要なため、管理者としてVisualStudioを起動する必要があります


Pure Kromeによる更新:

これに加えて、次のことを行う必要があります。これらのコメントは、私のweb.configの上部にあります(他のいくつかのものと一緒に...)。

1) netsh http add urlacl url=http://localhost.www.foo.com:80/ user=everyone
   netsh http add urlacl url=http://localhost.foo.com:80/ user=everyone
   netsh http add urlacl url=http://localhost.foobar.com.au:80/ user=everyone
   netsh http add urlacl url=http://localhost.pewpew.com:80/ user=everyone
   ... etc ... 
   NOTE: to remove a urlacl: netsh http delete urlacl url=<url in here> .. eg http://foo.com:80

2) ... and we need to edit the main IIS7 express config file to define the url's which will be accepted, per web -site-
    File: C:\Users\<UserName>\Documents\IISExpress\config\applicationhost.config
<bindings>
    <binding protocol="http" bindingInformation="*:1200:localhost" />
    <binding protocol="http" bindingInformation="*:80:localhost.www.foo.com" />
    <binding protocol="http" bindingInformation="*:80:localhost.foo.com" />
    <binding protocol="http" bindingInformation="*:80:localhost.foobar.com.au" />
    <binding protocol="http" bindingInformation="*:80:localhost.pewpew.com" />
</bindings>
于 2011-03-17T15:20:03.263 に答える
-1

上記のような IIS7 にバインドされたサイトのデバッグを成功させることができました。欠けているように見える唯一のステップは、プロジェクト内にあります。

  1. メニューから Project => [Project] Properties を選択
  2. [ウェブ] セクションをクリックします。
  3. 「カスタムWeb サーバーを使用する」オプションを選択し、サーバー URL を「http://dev.www.my-domain.com」に設定します。
于 2011-05-10T18:47:07.877 に答える