开发者

Using HttpListener in a Silverlight 4 Class Library

开发者 https://www.devze.com 2023-02-22 13:16 出处:网络
I have a Silverlight 4 class library and I\'m trying to use the HttpListener and associated types (HttpListenerContext, HttpListenerException, HttpUtility, etc.).

I have a Silverlight 4 class library and I'm trying to use the HttpListener and associated types (HttpListenerContext, HttpListenerException, HttpUtility, etc.).

However, VS2010 for some reason keeps giving me the following error:

Error 84 The type or namespace name 'HttpListener' could not be found (are you missing a using directive or an assembly reference?)

I looked at the reference in the project's References window (right click, View in Object Browser) and it seems to be pulling in System [2.0.5.0]. This assembly in fact does not contain the definition for those types (it's installed to %ProgramFiles%\Reference Assemblies\Microsoft\Framework\Silverlight\4.0\system.dll). Does this mean that I cannot use these types or am I just doing something stu开发者_高级运维pid with referencing the assembly?

Thanks!


Silverlight is effectively its own version of the .NET Framework with limited support for the full namespace set of the desktop .NET framework. See Nick Kramer's nice text file list of supported APIs in SL4 for more insight:

http://blogs.msdn.com/b/nickkramer/archive/2010/03/19/silverlight-4-rc-api-listing-in-one-big-text-file.aspx

As you'll note, there is no support for the namespace you specified directly or the dll you have added has dependencies on namespaces that are not supported by the underlying SL .NET Framework.

0

精彩评论

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