2010-12-10 3 views
0

IIS 7.0で新しいディレクトリXYZを作成しました。 web.config、Service.csおよびService.svcをディレクトリにコピーしました。今閲覧してhttp://www.mydomain.com/XYZ/Service.svc私は '500内部サーバーのエラー'を取得しています。Webサーバーへの単純なWCFサービスの展開

ここにweb.cofigファイルがあります。

<?xml version="1.0"?> 
<configuration> 

    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true"/>   
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

</configuration> 

設定ファイルに何らかの問題があるかもしれないと思っていますが、サービスはローカルマシン上でかなり正常に動作しています。

答えて

1

まず、コードファイルの代わりにdll-fileを使用する必要があります。コードをコンパイルし、 "bin"フォルダにdllを入れます。

秒で、あなたはweb.cofnigにエンドポイントを追加しませんでした:

<system.serviceModel> 
<!-- ... --> 
    <services> 
     <service name="SiteService"> 
      <endpoint address="" binding="basicHttpBinding" 
       contract="Name of the service interface with namespace, for exanple WebApplication1.IService1" /> 
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
     </service> 
    </services>  
</system.serviceModel> 

をとSVCファイルをチェックし、その内部のサービス名は、設定ファイル内のサービス名に対応している必要があります。サービスに<service name="SiteService">という行がある場合、svcファイルは

<%@ ServiceHost Language="C#" Debug="true" Service="SiteService" CodeBehind="Service.cs" %> 
である必要があります。