2016-08-22 5 views
2

IISでホストされているWCFサービスがあり、サービスは正常に動作しています。実際には、次のGlobal.asaxファイルとOrderService.svcファイルを順番に使用しています。ServiceHostのカスタムファクトリをGACからロードできません

<%@ Application Codebehind="Global.asax.cs" Inherits="MyCompany.MyOrderServices.Global" Language="C#" %> 

<%@ ServiceHost Language="C#" Debug="true" Service="MyCompany.ServiceLibrary.OrderServiceImpl" Factory="MyCompany.ServiceLibrary.GenericServiceHostFactoryImpl, MyCompany.ServiceLibrary"%> 

私は\ bin \ less WCFサービスを作成し、IISでホストしようとしています。私は必要なすべてのアセンブリをGACに入れました。私は次のエラーを取得サービスへの要求を行うときは:だから私はポイントを得た

<%@ Application Codebehind="Global.asax.cs" Inherits="MyCompany.MyOrderServices.Global, MyCompany.MyOrderServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXX" Language="C#" %> 

を::I

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load the assembly 'MyCompany.MyOrderServices'. Make sure that it is compiled before accessing the page.

Source File: /global.asax Line: 1

まあが、私は、Global.asaxのは、以下のようにファイルを変更することで、このエラーを修正しました単純な型名を型のアセンブリ修飾名に変更する必要がありました。実際にGlobal.asaxエラーを修正した後、次のエラーが発生します。

Could not load file or assembly 'MyCompany.ServiceLibrary' or one of its dependencies. The system cannot find the file specified.

それから私は、Fusionのログを有効にし、以下の情報だ:

=== Pre-bind state information ===

LOG: DisplayName = MyCompany.ServiceLibrary

(Partial)

WRN: Partial binding information was supplied for an assembly:

WRN: Assembly Name: MyCompany.ServiceLibrary | Domain ID: 4

WRN: A partial bind occurs when only part of the assembly display name is provided.

WRN: This might result in the binder loading an incorrect assembly.

WRN: It is recommended to provide a fully specified textual identity for the assembly,

WRN: that consists of the simple name, version, culture, and public key token.

WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.

LOG: Appbase = file:///C:/OrderServicePublish/

LOG: Initial PrivatePath = C:\OrderServicePublish\bin

Calling assembly : (Unknown).

===

LOG: This bind starts in default load context.

LOG: Using application configuration file: C:\OrderServicePublish\web.config

LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config

LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/98694738/2a3c07d8/MyCompany.MyServiceLibrary.DLL.

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/98694738/2a3c07d8/MyCompany.MyServiceLibrary/MyCompany.MyServiceLibrary.DLL.

LOG: Attempting download of new URL file:///C:/OrderServicePublish/bin/MyCompany.MyServiceLibrary.DLL.

LOG: Attempting download of new URL file:///C:/OrderServicePublish/bin/MyCompany.MyServiceLibrary/MyCompany.MyServiceLibrary.DLL.

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/98694738/2a3c07d8/MyCompany.MyServiceLibrary.EXE.

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/98694738/2a3c07d8/MyCompany.MyServiceLibrary/MyCompany.MyServiceLibrary.EXE.

LOG: Attempting download of new URL file:///C:/OrderServicePublish/bin/MyCompany.MyServiceLibrary.EXE.

LOG: Attempting download of new URL file:///C:/OrderServicePublish/bin/MyCompany.MyServiceLibrary/MyCompany.MyServiceLibrary.EXE.

どうやらGACフォルダがomitedされているが。次に、.svcファイルを次のように変更しました。

<%@ ServiceHost Language="C#" Debug="true" Service="MyCompany.ServiceLibrary.OrderServiceImpl, MyCompany.ServiceLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXX" Factory="MyCompany.ServiceLibrary.GenericServiceHostFactoryImpl, MyCompany.ServiceLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXX"%> 

...しかし、私は同じエラーが発生しています。 ServiceHostディレクティブの問題点アセンブリがGACフォルダから読み込まれないのはなぜですか?

(注1:ところで、私は、アセンブリ修飾型名に単純型の名前を変更するために示唆され、以下のリンクをチェックし、それは私のために働いていなかった

1。)https://social.msdn.microsoft.com/Forums/vstudio/en-US/3c61739c-b1fe-46bd-b8eb-8e9485f8891b/wcf-service-without-bin-folder?forum=wcf

2)http://answers.flyppdevportal.com/categories/sharepoint2010/sharepoint2010programming.aspx?ID=7b968dc5-4522-4896-8684-34064f0baaf5

+0

不一致があるとアセンブリがロードされないので、GACの名前、バージョン、強力な名前、およびカルチャでアセンブリを手動でチェックしましたか? –

+0

はい@ mrinal-kambojアセンブリのGACを確認しました。 :) – rebulanyum

+0

コンソールアプリケーションで同じリポジトリを試すことができますか?GACからロードされるものはすべて同じですが、環境内の実際の問題に絞り込むことを試みています。システム(PATH)に他のコピーがないことを確認してください。 –

答えて

0

ハ!

Web.configを編集するのを忘れてしまったように見えます。これにはアセンブリ名も含まれています。

<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"> 
    <add name="CORSEnablingModule" type="MyCompany.ServiceLibrary.Cors.CORSEnablingModule, MyCompany.ServiceLibrary" /> 
    </modules> 
</system.webServer> 

ここでは、完全修飾名に変更して、すべて正常です。

ありがとうございます。

+0

はい、そうですが、web.configのあなたの編集は、GACからアセンブリを正しく読み込むのに役立ちました。更新してください。そのため、Web.Configを持たないConsoleに関する提案がありました。 –

関連する問題