Actually my objective is;
- Create asp.net web service (namespace ws, class Service1)
- Create dll from web service
- Install this dll to GAC
- Create ASP.NET web application
- Don’t add a reference for this dll in the GAC
- Create Web User Control without any code behind the file
- Write code inside the Web User Control to use the Web Service
created above (without giving reference to application)
The question is;
- Can the web application searchs assembly inside GAC even if the
assembly wasn’t referenced to the application - Can I use this web
user control(in this situation UC won’t be compiled because it isn’t
code behinded) in other projects like WebParts?
PS: My last situation:
Service1.asmx.cs :
using System.Web.Services;
namespace ws
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
WebUserControl1.ascx :
<%@ Control Language="C#" ClassName="wuc" %>
<script runat="server">
protected override void CreateChildControls()
{
base.CreateChildControls();
ws.Service1 srv = new ws.Service1();
btn.Text = srv.HelloWorld();
}
</script>
<asp:Button runat="server" ID="btn" Text="asdasd" />
Default.aspx :
...
<%@ Register src="WebUserControl1.ascx" tagname="WebUserControl1" tagprefix="uc1" %>
...
<form id="form1" runat="server">
<div>
<uc1:WebUserControl1 ID="WebUserControl11" runat="server" />
</div>
</form>
...
I compiled and web page came up with this error:

I have learnt and posted to my blog.
First we need to generate dll from webservice:
We will deploy our webservice’s dll to GAC. So we need to have snk file. We will create dll file from our cs but before we need to create snk.
Now we can generate dll from cs file
Now we can deploy this dll to GAC
We can learn FullName of our dll in the GAC
in .ascx file we can write these lines inside to
script runat=servertag