开发者

Problem adding assembly reference to WCF web.config

开发者 https://www.devze.com 2023-03-17 18:22 出处:网络
I\'m trying to host a WCF service in IIS so that I can access the net.tcp binding from a Silverlight app. I\'ve been following steps from this tutorial:

I'm trying to host a WCF service in IIS so that I can access the net.tcp binding from a Silverlight app. I've been following steps from this tutorial:

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

I can get a simple example type service to work but when I try a real project I run into the following:

Line 6:  using NUnit.Framework;
CS0246: The type or namespace name 'NUnit' 
        could not be found (are you missing
        a using directive or an assembly reference?)

I know what you're thinking and yes it's true. I unit test.

My directory structure looks like this:

root: service.svc and app_code\

app_code: project file, web.config, bin\ and lots of code in开发者_开发问答 various directories

bin: debug folder

debug: nunit dlls and project binaries.

I've tried adding the following to my web.config:

<compilation>
  <assemblies>
    <add assembly="nunit.framework"/>
  </assemblies>
</compilation>

And I've played round with adding .dll and path names etc but they all result in:

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

How do I make the magic happen?

Tools: VSE2010, IIS7 Express, MS WebMatrix

EDIT: Changing the web.config file to:

<add assembly="nunit.framework, Version=2.5.9.10348, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77"/>

As suggested by Steve is the answer =)


First, I'd use the fully qualified name of the assembly. 9 times out of 10 that will fix your issue. How To: Determine an Assembly's Fully Qualified Name Also, make sure the assembly and all of it's dependencies are either in the GAC or in the BIN folder.

Then, if you're still having problems, Fusion will tell you exactly what's going on: Fusion Log Viewer Documentation on MSDN

0

精彩评论

暂无评论...
验证码 换一张
取 消